streamlit-nightly 1.41.2.dev20250202__py2.py3-none-any.whl → 1.42.1.dev20250205__py2.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 (184) hide show
  1. streamlit/auth_util.py +2 -1
  2. streamlit/commands/echo.py +4 -1
  3. streamlit/commands/execution_control.py +3 -1
  4. streamlit/commands/page_config.py +2 -1
  5. streamlit/config.py +56 -25
  6. streamlit/config_option.py +3 -3
  7. streamlit/connections/snowflake_connection.py +22 -10
  8. streamlit/connections/snowpark_connection.py +2 -1
  9. streamlit/connections/util.py +4 -1
  10. streamlit/dataframe_util.py +3 -8
  11. streamlit/delta_generator.py +1 -1
  12. streamlit/elements/alert.py +32 -4
  13. streamlit/elements/arrow.py +28 -15
  14. streamlit/elements/code.py +4 -3
  15. streamlit/elements/deck_gl_json_chart.py +3 -4
  16. streamlit/elements/form.py +22 -4
  17. streamlit/elements/heading.py +21 -6
  18. streamlit/elements/image.py +12 -3
  19. streamlit/elements/layouts.py +9 -4
  20. streamlit/elements/lib/built_in_chart_utils.py +1 -3
  21. streamlit/elements/lib/color_util.py +7 -6
  22. streamlit/elements/lib/column_config_utils.py +4 -3
  23. streamlit/elements/lib/column_types.py +100 -33
  24. streamlit/elements/lib/dicttools.py +4 -1
  25. streamlit/elements/lib/event_utils.py +2 -2
  26. streamlit/elements/lib/file_uploader_utils.py +4 -1
  27. streamlit/elements/lib/image_utils.py +5 -4
  28. streamlit/elements/lib/options_selector_utils.py +4 -1
  29. streamlit/elements/lib/pandas_styler_utils.py +2 -1
  30. streamlit/elements/lib/policies.py +3 -1
  31. streamlit/elements/lib/utils.py +1 -1
  32. streamlit/elements/map.py +3 -1
  33. streamlit/elements/markdown.py +21 -7
  34. streamlit/elements/media.py +2 -2
  35. streamlit/elements/metric.py +8 -4
  36. streamlit/elements/plotly_chart.py +4 -5
  37. streamlit/elements/spinner.py +25 -3
  38. streamlit/elements/text.py +7 -2
  39. streamlit/elements/vega_charts.py +26 -22
  40. streamlit/elements/widgets/audio_input.py +8 -4
  41. streamlit/elements/widgets/button.py +29 -12
  42. streamlit/elements/widgets/button_group.py +29 -13
  43. streamlit/elements/widgets/camera_input.py +8 -4
  44. streamlit/elements/widgets/chat.py +1 -3
  45. streamlit/elements/widgets/checkbox.py +16 -8
  46. streamlit/elements/widgets/color_picker.py +8 -4
  47. streamlit/elements/widgets/data_editor.py +10 -14
  48. streamlit/elements/widgets/file_uploader.py +12 -6
  49. streamlit/elements/widgets/multiselect.py +10 -5
  50. streamlit/elements/widgets/number_input.py +8 -4
  51. streamlit/elements/widgets/radio.py +11 -5
  52. streamlit/elements/widgets/select_slider.py +12 -8
  53. streamlit/elements/widgets/selectbox.py +11 -5
  54. streamlit/elements/widgets/slider.py +19 -17
  55. streamlit/elements/widgets/text_widgets.py +16 -8
  56. streamlit/elements/widgets/time_widgets.py +21 -15
  57. streamlit/elements/write.py +60 -43
  58. streamlit/errors.py +1 -2
  59. streamlit/external/langchain/streamlit_callback_handler.py +3 -3
  60. streamlit/hello/animation_demo.py +1 -1
  61. streamlit/material_icon_names.py +1 -1
  62. streamlit/proto/NewSession_pb2.py +16 -16
  63. streamlit/proto/NewSession_pb2.pyi +30 -3
  64. streamlit/runtime/app_session.py +15 -15
  65. streamlit/runtime/caching/cached_message_replay.py +2 -1
  66. streamlit/runtime/caching/hashing.py +3 -2
  67. streamlit/runtime/context.py +2 -1
  68. streamlit/runtime/forward_msg_cache.py +3 -1
  69. streamlit/runtime/memory_session_storage.py +4 -1
  70. streamlit/runtime/memory_uploaded_file_manager.py +4 -1
  71. streamlit/runtime/runtime.py +6 -4
  72. streamlit/runtime/scriptrunner/script_runner.py +4 -3
  73. streamlit/runtime/scriptrunner_utils/script_run_context.py +2 -3
  74. streamlit/runtime/secrets.py +1 -5
  75. streamlit/runtime/state/common.py +2 -4
  76. streamlit/runtime/state/query_params.py +2 -1
  77. streamlit/runtime/state/query_params_proxy.py +2 -1
  78. streamlit/runtime/state/safe_session_state.py +3 -1
  79. streamlit/runtime/state/session_state.py +2 -5
  80. streamlit/runtime/state/session_state_proxy.py +2 -1
  81. streamlit/runtime/uploaded_file_manager.py +3 -1
  82. streamlit/runtime/websocket_session_manager.py +8 -8
  83. streamlit/static/index.html +2 -2
  84. streamlit/static/static/css/{index.mUTQuMqR.css → index.DpJG_94W.css} +1 -1
  85. streamlit/static/static/js/{FileDownload.esm.Cf3bITtP.js → FileDownload.esm.ShSIWsKj.js} +1 -1
  86. streamlit/static/static/js/FileDropzone.BFkJKygp.js +5 -0
  87. streamlit/static/static/js/{FormClearHelper.BgwPD1tD.js → FormClearHelper.Bue0QSIn.js} +1 -1
  88. streamlit/static/static/js/{Hooks.BMaXaj11.js → Hooks.kV16_k1-.js} +1 -1
  89. streamlit/static/static/js/{InputInstructions.qlsk9gvt.js → InputInstructions.DpG38kbY.js} +1 -1
  90. streamlit/static/static/js/ProgressBar.B_WJAIyy.js +2 -0
  91. streamlit/static/static/js/{RenderInPortalIfExists.Blpdplqk.js → RenderInPortalIfExists.CGAGPcQq.js} +1 -1
  92. streamlit/static/static/js/{Toolbar.DMhyNpv2.js → Toolbar.DBtrI961.js} +1 -1
  93. streamlit/static/static/js/axios.upsvKRUO.js +6 -0
  94. streamlit/static/static/js/{base-input.DyTEaESI.js → base-input.P8VGAZdC.js} +4 -4
  95. streamlit/static/static/js/{createSuper.B3rIhdpQ.js → createSuper.GYQHnroV.js} +1 -1
  96. streamlit/static/static/js/{data-grid-overlay-editor.C9Q9Gy4e.js → data-grid-overlay-editor.B1sLTR3f.js} +1 -1
  97. streamlit/static/static/js/{downloader.BAMiKd1n.js → downloader.y-Ssi2d3.js} +1 -1
  98. streamlit/static/static/js/{es6.D82pr6dy.js → es6.DpUKmjxe.js} +2 -2
  99. streamlit/static/static/js/{iframeResizer.contentWindow.CJwxqR7x.js → iframeResizer.contentWindow.BBjdpeP0.js} +1 -1
  100. streamlit/static/static/js/{index.zlHOKWDA.js → index.2bJmI0Ih.js} +1 -1
  101. streamlit/static/static/js/{index.CjFbbEE0.js → index.3k422wEU.js} +1 -1
  102. streamlit/static/static/js/{index.P5kx9um8.js → index.B11A7C7I.js} +5 -5
  103. streamlit/static/static/js/{index.DiZyaYeV.js → index.B7AJyWjy.js} +3 -3
  104. streamlit/static/static/js/index.B7aeIxns.js +1 -0
  105. streamlit/static/static/js/index.BRsob9Jp.js +1 -0
  106. streamlit/static/static/js/{index.BLCqXxIG.js → index.BVkJfCWM.js} +1 -1
  107. streamlit/static/static/js/{index.B3Wxz7wG.js → index.BW_6EVtw.js} +1 -1
  108. streamlit/static/static/js/index.Bkk4sBLz.js +1 -0
  109. streamlit/static/static/js/{index.BcAjRRAZ.js → index.BqiT_qyM.js} +1 -1
  110. streamlit/static/static/js/index.C-BkiutF.js +1 -0
  111. streamlit/static/static/js/{index.C4kPuKr4.js → index.C73Hi-mL.js} +1 -1
  112. streamlit/static/static/js/{index.BM_J1KkD.js → index.C8vyFGOc.js} +1 -1
  113. streamlit/static/static/js/{index.CF4stbIZ.js → index.CAQGqUJ5.js} +1 -1
  114. streamlit/static/static/js/index.CC_i5fnL.js +3 -0
  115. streamlit/static/static/js/index.CIkzV9zP.js +2 -0
  116. streamlit/static/static/js/index.CIwUls4J.js +1 -0
  117. streamlit/static/static/js/{index.TPHsScPF.js → index.CUzW8sZB.js} +1 -1
  118. streamlit/static/static/js/index.CVIsVMt0.js +1 -0
  119. streamlit/static/static/js/{index.yp4f0OMe.js → index.CZFA90VV.js} +2 -2
  120. streamlit/static/static/js/{index.5JFTbX2J.js → index.Cd8_b4vi.js} +1 -1
  121. streamlit/static/static/js/{index.BdEYCAFh.js → index.CoJayF2l.js} +1 -1
  122. streamlit/static/static/js/index.Cp60C2LQ.js +1 -0
  123. streamlit/static/static/js/index.D-Qsohh0.js +1 -0
  124. streamlit/static/static/js/index.D2i6l9uv.js +1 -0
  125. streamlit/static/static/js/{index.BZvQkTCS.js → index.D3PlNa4T.js} +1 -1
  126. streamlit/static/static/js/{index.8Q56Jjmk.js → index.D7HtU_R4.js} +1 -1
  127. streamlit/static/static/js/{index.BdlaxG49.js → index.DHOnt3Rd.js} +1 -1
  128. streamlit/static/static/js/index.DNKGONSt.js +1 -0
  129. streamlit/static/static/js/{index.Y84nTPW2.js → index.D_CViY1G.js} +1 -1
  130. streamlit/static/static/js/{index.D9yF6cxC.js → index.DdJR-Re7.js} +1 -1
  131. streamlit/static/static/js/index.DdaoJ1WZ.js +73 -0
  132. streamlit/static/static/js/{index.CoE1gpPQ.js → index.DsOZJLyF.js} +1 -1
  133. streamlit/static/static/js/{index.B7J6suR-.js → index.DuqdUleB.js} +200 -200
  134. streamlit/static/static/js/{index.NbimJbgq.js → index.GZ99DH1Q.js} +6 -6
  135. streamlit/static/static/js/{index.CC5oiyoV.js → index.OWYUy0bC.js} +2 -2
  136. streamlit/static/static/js/index.USVf5VUT.js +1 -0
  137. streamlit/static/static/js/{input.DRyjjTTH.js → input.BANuQoGH.js} +2 -2
  138. streamlit/static/static/js/{memory.C98yjNkk.js → memory.DTxlMbK7.js} +1 -1
  139. streamlit/static/static/js/{mergeWith.CLihEflw.js → mergeWith.CfihrnQo.js} +1 -1
  140. streamlit/static/static/js/{number-overlay-editor.DozQhDJj.js → number-overlay-editor.BHsEp8VL.js} +1 -1
  141. streamlit/static/static/js/{possibleConstructorReturn.DJ7-JsJc.js → possibleConstructorReturn.BErM7qST.js} +1 -1
  142. streamlit/static/static/js/{sandbox.0Tj4C46D.js → sandbox.BMuVLu80.js} +1 -1
  143. streamlit/static/static/js/{textarea.CUrV8-V3.js → textarea.CmSZv6UE.js} +2 -2
  144. streamlit/static/static/js/{timepicker.DEu3fwJe.js → timepicker.DsaAj0da.js} +4 -4
  145. streamlit/static/static/js/{toConsumableArray.C71OtXzK.js → toConsumableArray.DJs7oxRq.js} +1 -1
  146. streamlit/static/static/js/{uniqueId.CndDhnid.js → uniqueId.CVe3uxKs.js} +1 -1
  147. streamlit/static/static/js/useBasicWidgetState.D572sX2t.js +1 -0
  148. streamlit/static/static/js/{useOnInputChange.CvHbHWmy.js → useOnInputChange.D9rTVyjn.js} +1 -1
  149. streamlit/static/static/js/{withFullScreenWrapper.BLLyDFUF.js → withFullScreenWrapper.4QDrgZxA.js} +1 -1
  150. streamlit/static/static/media/MaterialSymbols-Rounded.DcZbplWk.woff2 +0 -0
  151. streamlit/testing/v1/app_test.py +3 -1
  152. streamlit/testing/v1/element_tree.py +3 -4
  153. streamlit/testing/v1/local_script_runner.py +3 -3
  154. streamlit/type_util.py +11 -8
  155. streamlit/user_info.py +2 -3
  156. streamlit/watcher/path_watcher.py +4 -4
  157. streamlit/web/server/authlib_tornado_integration.py +3 -1
  158. streamlit/web/server/browser_websocket_handler.py +3 -1
  159. streamlit/web/server/routes.py +4 -1
  160. streamlit/web/server/server.py +2 -1
  161. {streamlit_nightly-1.41.2.dev20250202.dist-info → streamlit_nightly-1.42.1.dev20250205.dist-info}/METADATA +1 -2
  162. {streamlit_nightly-1.41.2.dev20250202.dist-info → streamlit_nightly-1.42.1.dev20250205.dist-info}/RECORD +166 -165
  163. streamlit/static/static/js/FileDropzone.B8wCqKiM.js +0 -5
  164. streamlit/static/static/js/ProgressBar.Di2oT-20.js +0 -2
  165. streamlit/static/static/js/index.B79cf7gS.js +0 -1
  166. streamlit/static/static/js/index.BBPZ3wsr.js +0 -1
  167. streamlit/static/static/js/index.BKahTKEx.js +0 -3
  168. streamlit/static/static/js/index.CSGfgCnQ.js +0 -1
  169. streamlit/static/static/js/index.CYMgsYSm.js +0 -1
  170. streamlit/static/static/js/index.CZjnqbcd.js +0 -73
  171. streamlit/static/static/js/index.C_4BuzGH.js +0 -1
  172. streamlit/static/static/js/index.CjiPq39N.js +0 -1
  173. streamlit/static/static/js/index.CjuTYYFG.js +0 -1
  174. streamlit/static/static/js/index.CqGcWpm5.js +0 -2
  175. streamlit/static/static/js/index.CuH7mftz.js +0 -1
  176. streamlit/static/static/js/index.DFJg1zHB.js +0 -1
  177. streamlit/static/static/js/index.Dm3nmdhh.js +0 -1
  178. streamlit/static/static/js/index.rrDohWOh.js +0 -1
  179. streamlit/static/static/js/useBasicWidgetState.DXLMTaiS.js +0 -1
  180. streamlit/static/static/media/MaterialSymbols-Rounded.DzyB5T7Y.woff2 +0 -0
  181. {streamlit_nightly-1.41.2.dev20250202.data → streamlit_nightly-1.42.1.dev20250205.data}/scripts/streamlit.cmd +0 -0
  182. {streamlit_nightly-1.41.2.dev20250202.dist-info → streamlit_nightly-1.42.1.dev20250205.dist-info}/WHEEL +0 -0
  183. {streamlit_nightly-1.41.2.dev20250202.dist-info → streamlit_nightly-1.42.1.dev20250205.dist-info}/entry_points.txt +0 -0
  184. {streamlit_nightly-1.41.2.dev20250202.dist-info → streamlit_nightly-1.42.1.dev20250205.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,3 @@
1
+ import{bw as P,bJ as ve,bx as O,r as u,y as me,z as ne,j as R,bB as ye,bt as $e,bc as Oe,bu as Re,aE as oe,bs as _e}from"./index.DuqdUleB.js";import{a as Pe}from"./useBasicWidgetState.D572sX2t.js";import"./FormClearHelper.Bue0QSIn.js";var ie={vertical:"vertical",horizontal:"horizontal"};function ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function D(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ae(Object(n),!0).forEach(function(r){_(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ae(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var E=0,I=1,L=2;function B(e){return e.$isActive?L:e.$isHovered?I:E}function we(e){var t=e.$theme.colors,n=e.$disabled,r=e.$checked,o=e.$isFocusVisible,i=e.$error;if(n)return t.tickFillDisabled;if(r)if(i)switch(B(e)){case E:return t.tickFillErrorSelected;case I:return t.tickFillErrorSelectedHover;case L:return t.tickFillErrorSelectedHoverActive}else switch(B(e)){case E:return t.tickFillSelected;case I:return t.tickFillSelectedHover;case L:return t.tickFillSelectedHoverActive}else return o?t.borderSelected:i?t.tickBorderError:t.tickBorder;return null}function Se(e){var t=e.$theme.colors;if(e.$disabled)return t.tickMarkFillDisabled;if(e.$checked)return t.tickMarkFill;if(e.$error)switch(B(e)){case E:return t.tickFillError;case I:return t.tickFillErrorHover;case L:return t.tickFillErrorHoverActive}else switch(B(e)){case E:return t.tickFill;case I:return t.tickFillHover;case L:return t.tickFillActive}}function Me(e){var t=e.$labelPlacement,n=t===void 0?"":t,r=e.$theme,o;switch(n){case"top":o="Bottom";break;case"bottom":o="Top";break;case"left":o=r.direction==="rtl"?"Left":"Right";break;default:case"right":o=r.direction==="rtl"?"Right":"Left";break}var i=r.sizing,s=i.scale300;return _({},"padding".concat(o),s)}function ke(e){var t=e.$disabled,n=e.$theme,r=n.colors;return t?r.contentSecondary:r.contentPrimary}var q=P("div",function(e){var t=e.$disabled,n=e.$align;return{display:"flex",flexWrap:"wrap",flexDirection:n==="horizontal"?"row":"column",alignItems:n==="horizontal"?"center":"flex-start",cursor:t?"not-allowed":"pointer","-webkit-tap-highlight-color":"transparent"}});q.displayName="RadioGroupRoot";q.displayName="RadioGroupRoot";var X=P("label",function(e){var t,n=e.$disabled,r=e.$hasDescription,o=e.$labelPlacement,i=e.$theme,s=e.$align,a=i.sizing,c=s==="horizontal",h=i.direction==="rtl"?"Left":"Right";return t={flexDirection:o==="top"||o==="bottom"?"column":"row",display:"flex",alignItems:"center",cursor:n?"not-allowed":"pointer",marginTop:a.scale200},_(t,"margin".concat(h),c?a.scale200:null),_(t,"marginBottom",r&&!c?null:a.scale200),t});X.displayName="Root";X.displayName="Root";var J=P("div",function(e){var t=e.$theme,n=t.animation,r=t.sizing;return{backgroundColor:Se(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",height:e.$checked?r.scale200:r.scale550,transitionDuration:n.timing200,transitionTimingFunction:n.easeOutCurve,width:e.$checked?r.scale200:r.scale550}});J.displayName="RadioMarkInner";J.displayName="RadioMarkInner";var K=P("div",function(e){var t=e.$theme,n=t.animation,r=t.sizing;return{alignItems:"center",backgroundColor:we(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible&&e.$checked?"0 0 0 3px ".concat(e.$theme.colors.accent):"none",display:"flex",height:r.scale700,justifyContent:"center",marginTop:r.scale0,marginRight:r.scale0,marginBottom:r.scale0,marginLeft:r.scale0,outline:"none",verticalAlign:"middle",width:r.scale700,flexShrink:0,transitionDuration:n.timing200,transitionTimingFunction:n.easeOutCurve}});K.displayName="RadioMarkOuter";K.displayName="RadioMarkOuter";var Q=P("div",function(e){var t=e.$theme.typography;return D(D({verticalAlign:"middle"},Me(e)),{},{color:ke(e)},t.LabelMedium)});Q.displayName="Label";Q.displayName="Label";var Y=P("input",{width:0,height:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,clip:"rect(0 0 0 0)",position:"absolute"});Y.displayName="Input";Y.displayName="Input";var Z=P("div",function(e){var t,n=e.$theme,r=e.$align,o=r==="horizontal",i=n.direction==="rtl"?"Right":"Left",s=n.direction==="rtl"?"Left":"Right";return D(D({},n.typography.ParagraphSmall),{},(t={color:n.colors.contentSecondary,cursor:"auto"},_(t,"margin".concat(i),r==="horizontal"?null:n.sizing.scale900),_(t,"margin".concat(s),o?n.sizing.scale200:null),_(t,"maxWidth","240px"),t))});Z.displayName="Description";Z.displayName="Description";function N(e){"@babel/helpers - typeof";return N=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(e)}function V(){return V=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},V.apply(this,arguments)}function Fe(e,t){return Te(e)||Le(e,t)||Ie(e,t)||Ee()}function Ee(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ie(e,t){if(e){if(typeof e=="string")return se(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return se(e,t)}}function se(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Le(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,s,a;try{for(n=n.call(e);!(o=(s=n.next()).done)&&(r.push(s.value),!(t&&r.length===t));o=!0);}catch(c){i=!0,a=c}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw a}}return r}}function Te(e){if(Array.isArray(e))return e}function Ae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function je(e,t,n){return t&&xe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function De(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&U(e,t)}function U(e,t){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},U(e,t)}function Be(e){var t=ze();return function(){var r=C(e),o;if(t){var i=C(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Ce(this,o)}}function Ce(e,t){if(t&&(N(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return x(e)}function x(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ze(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},C(e)}function j(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ue=function(e){De(n,e);var t=Be(n);function n(){var r;Ae(this,n);for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return r=t.call.apply(t,[this].concat(i)),j(x(r),"state",{isFocusVisible:!1,focusedRadioIndex:-1}),j(x(r),"handleFocus",function(a,c){ve(a)&&r.setState({isFocusVisible:!0}),r.setState({focusedRadioIndex:c}),r.props.onFocus&&r.props.onFocus(a)}),j(x(r),"handleBlur",function(a,c){r.state.isFocusVisible!==!1&&r.setState({isFocusVisible:!1}),r.setState({focusedRadioIndex:-1}),r.props.onBlur&&r.props.onBlur(a)}),r}return je(n,[{key:"render",value:function(){var o=this,i=this.props.overrides,s=i===void 0?{}:i,a=O(s.RadioGroupRoot,q),c=Fe(a,2),h=c[0],b=c[1];return u.createElement(h,V({id:this.props.id,role:"radiogroup","aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props.error||null,"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],$align:this.props.align,$disabled:this.props.disabled,$error:this.props.error,$required:this.props.required},b),u.Children.map(this.props.children,function(p,f){if(!u.isValidElement(p))return null;var l=o.props.value===p.props.value;return u.cloneElement(p,{align:o.props.align,autoFocus:o.props.autoFocus,checked:l,disabled:o.props.disabled||p.props.disabled,error:o.props.error,isFocused:o.state.focusedRadioIndex===f,isFocusVisible:o.state.isFocusVisible,tabIndex:f===0&&!o.props.value||l?"0":"-1",labelPlacement:o.props.labelPlacement,name:o.props.name,onBlur:function(d){return o.handleBlur(d,f)},onFocus:function(d){return o.handleFocus(d,f)},onChange:o.props.onChange,onMouseEnter:o.props.onMouseEnter,onMouseLeave:o.props.onMouseLeave})}))}}]),n}(u.Component);j(ue,"defaultProps",{name:"",value:"",disabled:!1,autoFocus:!1,labelPlacement:"right",align:"vertical",error:!1,required:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onFocus:function(){},onBlur:function(){},overrides:{}});function G(e){"@babel/helpers - typeof";return G=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},G(e)}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},y.apply(this,arguments)}function M(e,t){return Ue(e)||Ve(e,t)||Ne(e,t)||He()}function He(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ne(e,t){if(e){if(typeof e=="string")return le(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return le(e,t)}}function le(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ve(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,s,a;try{for(n=n.call(e);!(o=(s=n.next()).done)&&(r.push(s.value),!(t&&r.length===t));o=!0);}catch(c){i=!0,a=c}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw a}}return r}}function Ue(e){if(Array.isArray(e))return e}function Ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function We(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function qe(e,t,n){return t&&We(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Xe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&W(e,t)}function W(e,t){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},W(e,t)}function Je(e){var t=Qe();return function(){var r=z(e),o;if(t){var i=z(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Ke(this,o)}}function Ke(e,t){if(t&&(G(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return k(e)}function k(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Qe(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function z(e){return z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},z(e)}function F(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ye(e){return e==="top"||e==="left"}function Ze(e){return e==="bottom"||e==="right"}var et=function(t){return t.stopPropagation()},ce=function(e){Xe(n,e);var t=Je(n);function n(){var r;Ge(this,n);for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return r=t.call.apply(t,[this].concat(i)),F(k(r),"state",{isActive:!1,isHovered:!1}),F(k(r),"onMouseEnter",function(a){r.setState({isHovered:!0}),r.props.onMouseEnter&&r.props.onMouseEnter(a)}),F(k(r),"onMouseLeave",function(a){r.setState({isHovered:!1}),r.props.onMouseLeave&&r.props.onMouseLeave(a)}),F(k(r),"onMouseDown",function(a){r.setState({isActive:!0}),r.props.onMouseDown&&r.props.onMouseDown(a)}),F(k(r),"onMouseUp",function(a){r.setState({isActive:!1}),r.props.onMouseUp&&r.props.onMouseUp(a)}),r}return qe(n,[{key:"componentDidMount",value:function(){var o;this.props.autoFocus&&(o=this.props.inputRef)!==null&&o!==void 0&&o.current&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var o=this.props.overrides,i=o===void 0?{}:o,s=O(i.Root,X),a=M(s,2),c=a[0],h=a[1],b=O(i.Label,Q),p=M(b,2),f=p[0],l=p[1],$=O(i.Input,Y),d=M($,2),T=d[0],H=d[1],w=O(i.Description,Z),A=M(w,2),v=A[0],g=A[1],m=O(i.RadioMarkInner,J),ee=M(m,2),pe=ee[0],fe=ee[1],de=O(i.RadioMarkOuter,K),te=M(de,2),he=te[0],be=te[1],S={$align:this.props.align,$checked:this.props.checked,$disabled:this.props.disabled,$hasDescription:!!this.props.description,$isActive:this.state.isActive,$error:this.props.error,$isFocused:this.props.isFocused,$isFocusVisible:this.props.isFocused&&this.props.isFocusVisible,$isHovered:this.state.isHovered,$labelPlacement:this.props.labelPlacement,$required:this.props.required,$value:this.props.value},re=u.createElement(f,y({},S,l),this.props.containsInteractiveElement?u.createElement("div",{onClick:function(ge){return ge.preventDefault()}},this.props.children):this.props.children);return u.createElement(u.Fragment,null,u.createElement(c,y({"data-baseweb":"radio",onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},S,h),Ye(this.props.labelPlacement)&&re,u.createElement(he,y({},S,be),u.createElement(pe,y({},S,fe))),u.createElement(T,y({"aria-invalid":this.props.error||null,checked:this.props.checked,disabled:this.props.disabled,name:this.props.name,onBlur:this.props.onBlur,onFocus:this.props.onFocus,onClick:et,onChange:this.props.onChange,ref:this.props.inputRef,required:this.props.required,tabIndex:this.props.tabIndex,type:"radio",value:this.props.value},S,H)),Ze(this.props.labelPlacement)&&re),!!this.props.description&&u.createElement(v,y({},S,g),this.props.description))}}]),n}(u.Component);F(ce,"defaultProps",{overrides:{},containsInteractiveElement:!1,checked:!1,disabled:!1,autoFocus:!1,inputRef:u.createRef(),align:"vertical",error:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});function tt({disabled:e,horizontal:t,width:n,value:r,onChange:o,options:i,captions:s,label:a,labelVisibility:c,help:h}){const[b,p]=u.useState(r??null);u.useEffect(()=>{r!==b&&p(r??null)},[r]);const f=u.useCallback(v=>{const g=parseInt(v.target.value,10);p(g),o(g)},[o]),l=me(),$={width:n},d=s.length>0,T=i.length>0,H=T?i:["No options to select."],w=e||!T,A=v=>v==""&&t&&d?"&nbsp;":v;return ne("div",{className:"stRadio","data-testid":"stRadio",style:$,children:[R(Re,{label:a,disabled:w,labelVisibility:c,children:h&&R(ye,{children:R($e,{content:h,placement:Oe.TOP_RIGHT})})}),R(ue,{onChange:f,value:b!==null?b.toString():void 0,disabled:w,align:t?ie.horizontal:ie.vertical,"aria-label":a,"data-testid":"stRadioGroup",overrides:{RadioGroupRoot:{style:{gap:d?l.spacing.sm:l.spacing.none,minHeight:l.sizes.minElementHeight}}},children:H.map((v,g)=>ne(ce,{value:g.toString(),overrides:{Root:{style:({$isFocusVisible:m})=>({marginBottom:l.spacing.none,marginTop:l.spacing.none,marginRight:d?l.spacing.sm:l.spacing.lg,paddingLeft:l.spacing.none,alignItems:"start",paddingRight:l.spacing.threeXS,backgroundColor:m?l.colors.darkenedBgMix25:""})},RadioMarkOuter:{style:({$checked:m})=>({width:l.sizes.checkbox,height:l.sizes.checkbox,marginTop:"0.35rem",marginRight:l.spacing.none,marginLeft:l.spacing.none,backgroundColor:m&&!w?l.colors.primary:l.colors.fadedText40})},RadioMarkInner:{style:({$checked:m})=>({height:m?"37.5%":`calc(${l.sizes.checkbox} - ${l.spacing.threeXS})`,width:m?"37.5%":`calc(${l.sizes.checkbox} - ${l.spacing.threeXS})`})},Label:{style:{color:w?l.colors.fadedText40:l.colors.bodyText,position:"relative",top:l.spacing.px}}},children:[R(oe,{source:v,allowHTML:!1,isLabel:!0,largerLabel:!0}),d&&R(oe,{source:A(s[g]),allowHTML:!1,isCaption:!0,isLabel:!0})]},g))})]})}const rt=u.memo(tt);function nt({disabled:e,element:t,widgetMgr:n,width:r,fragmentId:o}){const[i,s]=Pe({getStateFromWidgetMgr:ot,getDefaultStateFromProto:it,getCurrStateFromProto:at,updateWidgetMgrState:st,element:t,widgetMgr:n,fragmentId:o}),a=u.useCallback($=>{s({value:$,fromUi:!0})},[s]),{horizontal:c,options:h,captions:b,label:p,labelVisibility:f,help:l}=t;return R(rt,{label:p,onChange:a,options:h,captions:b,width:r,disabled:e,horizontal:c,labelVisibility:_e(f==null?void 0:f.value),value:i??null,help:l})}function ot(e,t){return e.getIntValue(t)}function it(e){return e.default??null}function at(e){return e.value??null}function st(e,t,n,r){t.setIntValue(e,n.value??null,{fromUi:n.fromUi},r)}const ft=u.memo(nt);export{ft as default};
@@ -0,0 +1,2 @@
1
+ import{bw as Z,bx as J,r as f,by as Q,y as Y,bz as s,j as v,z as ee,bs as te,bA as re,bB as ne,bt as oe,bc as ie,bu as ae,bq as ue,b8 as P,b7 as W,ba as le}from"./index.DuqdUleB.js";import{a as ce}from"./useBasicWidgetState.D572sX2t.js";import"./FormClearHelper.Bue0QSIn.js";var se={primary:"primary",secondary:"secondary",tertiary:"tertiary"},G={default:"default",pill:"pill",round:"round",circle:"circle",square:"square"},fe={mini:"mini",default:"default",compact:"compact",large:"large"},k=Object.freeze({radio:"radio",checkbox:"checkbox"}),z=Z("div",function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=r===1?void 0:t!==G.default?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}});z.displayName="StyledRoot";z.displayName="StyledRoot";function j(e){"@babel/helpers - typeof";return j=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(e)}function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},M.apply(this,arguments)}function x(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function pe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?x(Object(r),!0).forEach(function(n){N(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function de(e,t){return he(e)||me(e,t)||be(e,t)||ye()}function ye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function be(e,t){if(e){if(typeof e=="string")return X(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return X(e,t)}}function X(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function me(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,p;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(c){i=!0,p=c}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw p}}return n}}function he(e){if(Array.isArray(e))return e}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Se(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ve(e,t,r){return t&&Se(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Oe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$(e,t)}function $(e,t){return $=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},$(e,t)}function Ee(e){var t=we();return function(){var n=A(e),o;if(t){var i=A(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return _e(this,o)}}function _e(e,t){if(t&&(j(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return K(e)}function K(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function we(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function A(e){return A=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},A(e)}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Le(e,t){return!Array.isArray(e)&&typeof e!="number"?!1:Array.isArray(e)?e.includes(t):e===t}var F=function(e){Oe(r,e);var t=Ee(r);function r(){var n;ge(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=t.call.apply(t,[this].concat(i)),N(K(n),"childRefs",{}),n}return ve(r,[{key:"render",value:function(){var o=this,i=this.props,a=i.overrides,p=a===void 0?{}:a,c=i.mode,C=c===void 0?k.checkbox:c,d=i.children,y=i.selected,m=i.disabled,l=i.onClick,_=i.kind,h=i.shape,w=i.size,B=J(p.Root,z),O=de(B,2),E=O[0],L=O[1],q=this.props["aria-label"]||this.props.ariaLabel,g=C===k.radio,V=f.Children.count(d);return f.createElement(Q.Consumer,null,function(H){return f.createElement(E,M({"aria-label":q||H.buttongroup.ariaLabel,"data-baseweb":"button-group",role:g?"radiogroup":"group",$shape:h,$length:d.length},L),f.Children.map(d,function(b,R){if(!f.isValidElement(b))return null;var I=b.props.isSelected?b.props.isSelected:Le(y,R);return g&&(o.childRefs[R]=f.createRef()),f.cloneElement(b,{disabled:m||b.props.disabled,isSelected:I,ref:g?o.childRefs[R]:void 0,tabIndex:!g||I||g&&(!y||y===-1)&&R===0?0:-1,onKeyDown:function(u){if(g){var S=Number(y)?Number(y):0;if(u.key==="ArrowUp"||u.key==="ArrowLeft"){u.preventDefault&&u.preventDefault();var T=S-1<0?V-1:S-1;l&&l(u,T),o.childRefs[T].current&&o.childRefs[T].current.focus()}if(u.key==="ArrowDown"||u.key==="ArrowRight"){u.preventDefault&&u.preventDefault();var D=S+1>V-1?0:S+1;l&&l(u,D),o.childRefs[D].current&&o.childRefs[D].current.focus()}}},kind:_,onClick:function(u){m||(b.props.onClick&&b.props.onClick(u),l&&l(u,R))},shape:h,size:w,overrides:pe({BaseButton:{style:function(u){var S=u.$theme;return d.length===1?{}:h!==G.default?{marginLeft:S.sizing.scale100,marginRight:S.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":I,role:g?"radio":"checkbox"}}},b.props.overrides)})}))})}}]),r}(f.Component);N(F,"defaultProps",{disabled:!1,onClick:function(){},shape:G.default,size:fe.default,kind:se.secondary});function Re(e,t){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}function Pe(e,t,r){return e==s.ClickMode.MULTI_SELECT?Re(t,r??[]):r!=null&&r.includes(t)?[]:[t]}function Ce(e){return e.length===0?-1:e[0]}function ke(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function Ae(e,t,r){const n=r===s.Style.PILLS?P.PILLS:r===s.Style.BORDERLESS?P.BORDERLESS_ICON:P.SEGMENTED_CONTROL,o=r===s.Style.BORDERLESS?W.XSMALL:W.MEDIUM,i=n===P.PILLS||n===P.SEGMENTED_CONTROL,a=r===s.Style.BORDERLESS?"lg":"base";return{element:v(le,{icon:t,label:e,iconSize:a,useSmallerFont:i}),kind:n,size:o}}function Be(e,t,r,n){return r.indexOf(n)>-1?!0:t!==s.ClickMode.SINGLE_SELECT||e!==s.SelectionVisualization.ALL_UP_TO_SELECTED?!1:r.length>0&&n<r[0]}function Ie(e,t){return e&&(t=`${t}Active`),t}function Te(e,t){const r={flexWrap:"wrap",maxWidth:"fit-content"};switch(e){case s.Style.BORDERLESS:return{...r,columnGap:t.threeXS,rowGap:t.threeXS};case s.Style.PILLS:return{...r,columnGap:t.twoXS,rowGap:t.twoXS};case s.Style.SEGMENTED_CONTROL:return{...r,columnGap:t.none,rowGap:t.twoXS,"::after":{content:"''",flex:1e4}};default:return r}}function De(e,t,r,n,o,i){const a=Be(r,n,o,t);let p=e.content,c=e.contentIcon;return a&&(p=e.selectedContent?e.selectedContent:p,c=e.selectedContentIcon?e.selectedContentIcon:c),f.forwardRef(function(d,y){const{element:m,kind:l,size:_}=Ae(p??"",c??void 0,i),h=Ie(!!(a&&!e.selectedContent&&!e.selectedContentIcon),l);return v(ue,{...d,size:_,kind:h,children:m})})}function je(e,t){return e.getIntArrayValue(t)}function Me(e){return e.default??null}function $e(e){return e.value??null}function Ge(e){const{disabled:t,element:r,fragmentId:n,widgetMgr:o}=e,{clickMode:i,options:a,selectionVisualization:p,style:c,label:C,labelVisibility:d,help:y}=r,m=Y(),[l,_]=ce({getStateFromWidgetMgr:je,getDefaultStateFromProto:Me,getCurrStateFromProto:$e,updateWidgetMgrState:ke,element:r,widgetMgr:o,fragmentId:n}),h=(O,E)=>{const L=Pe(i,E,l);_({value:L,fromUi:!0})};let w;i===s.ClickMode.SINGLE_SELECT?w=k.radio:i===s.ClickMode.MULTI_SELECT&&(w=k.checkbox);const B=f.useMemo(()=>a.map((O,E)=>{const L=De(O,E,p,i,l,c);return v(L,{},`${O.content}-${E}`)}),[i,a,p,c,l]);return ee("div",{className:"stButtonGroup","data-testid":"stButtonGroup",children:[v(ae,{label:C,disabled:t,labelVisibility:te((d==null?void 0:d.value)??re.LabelVisibilityOptions.COLLAPSED),children:y&&v(ne,{children:v(oe,{content:y,placement:ie.TOP})})}),v(F,{disabled:t,mode:w,onClick:h,selected:i===s.ClickMode.MULTI_SELECT?l:Ce(l),overrides:{Root:{style:f.useCallback(()=>Te(c,m.spacing),[c,m.spacing])}},children:B})]})}const Ue=f.memo(Ge);export{Ue as default};
@@ -0,0 +1 @@
1
+ import{r as o,E as K,_ as X,n as k,aR as lt,al as ut,cq as ct,M as J,cB as I,J as f,z as N,j as c,bs as dt,bF as pt,bt as ft,bc as bt,bu as mt,bp as M}from"./index.DuqdUleB.js";import{s as gt}from"./sprintf.C-r3gIuM.js";import{u as yt}from"./uniqueId.CVe3uxKs.js";import{u as It}from"./FormClearHelper.Bue0QSIn.js";import{I as ht}from"./InputInstructions.DpG38kbY.js";import{I as Tt}from"./input.BANuQoGH.js";import"./base-input.P8VGAZdC.js";var Q=o.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(K,X({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),o.createElement("path",{d:"M0 3v2h8V3H0z"}))});Q.displayName="Minus";var Y=o.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(K,X({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),o.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});Y.displayName="Plus";const Ct=k("div",{target:"e1izef4y0"})(({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.bgColor,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}}})),wt=k("div",{target:"e1izef4y1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),q=k("button",{target:"e1izef4y2"})(({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}})),St=k("div",{target:"e1izef4y3"})(({theme:t,clearable:e})=>({position:"absolute",marginRight:t.spacing.twoXS,left:0,right:`calc(${t.sizes.numberInputControlsWidth} * 2 + ${e?"1em":"0em"})`})),Vt=ut.getLogger("NumberInput");function vt(t){return f(t)||t===""?void 0:t}const xt=t=>(t.element.dataType===I.DataType.INT?t.widgetMgr.getIntValue(t.element):t.widgetMgr.getDoubleValue(t.element))??t.element.default??null,G=({step:t,dataType:e})=>t||(e===I.DataType.INT?1:.01),W=({value:t,format:e,step:r,dataType:h})=>{if(f(t))return null;let n=vt(e);if(f(n)&&J(r)){const l=r.toString();h===I.DataType.FLOAT&&r!==0&&l.includes(".")&&(n=`%0.${l.split(".")[1].length}f`)}if(f(n))return t.toString();try{return gt.sprintf(n,t)}catch(l){return Vt.warn(`Error in sprintf(${n}, ${t}): ${l}`),String(t)}},kt=(t,e,r)=>f(t)?!1:t-e>=r,Rt=(t,e,r)=>f(t)?!1:t+e<=r,Dt=({disabled:t,element:e,widgetMgr:r,width:h,theme:n,fragmentId:l})=>{var O;const{dataType:w,id:R,formId:p,default:B,format:A}=e,b=e.hasMin?e.min:-1/0,m=e.hasMax?e.max:1/0,[s,Z]=o.useState(G(e)),H=xt({element:e,widgetMgr:r}),[g,T]=o.useState(!1),[i,C]=o.useState(H),[P,S]=o.useState(W({value:H,...e,step:s})),[U,$]=o.useState(!1),D=o.useRef(null),L=o.useRef(yt("number_input_")),V=kt(i,s,b),v=Rt(i,s,m),_=ct({formId:p}),tt=_?r.allowFormEnterToSubmit(p):g,et=U&&h>n.breakpoints.hideWidgetDetails;o.useEffect(()=>{Z(G({step:e.step,dataType:e.dataType}))},[e.dataType,e.step]);const u=o.useCallback(({value:a,source:d})=>{var y;if(J(a)&&(b>a||a>m))(y=D.current)==null||y.reportValidity();else{const x=a??B??null;switch(w){case I.DataType.INT:r.setIntValue({id:R,formId:p},x,d,l);break;case I.DataType.FLOAT:r.setDoubleValue({id:R,formId:p},x,d,l);break;default:throw new Error("Invalid data type")}T(!1),C(x),S(W({value:x,dataType:w,format:A,step:s}))}},[b,m,D,r,l,s,w,R,p,B,A]),ot=o.useCallback(()=>{g&&u({value:i,source:{fromUi:!0}}),$(!1)},[g,i,u]),rt=o.useCallback(()=>{$(!0)},[]),j=o.useCallback(()=>{const{value:a}=e;e.setValue=!1,C(a??null),S(W({value:a??null,...e,step:s})),u({value:a??null,source:{fromUi:!1}})},[e,s,u]);o.useEffect(()=>{e.setValue?j():u({value:i,source:{fromUi:!1}})},[]),e.setValue&&j();const F=f(e.default)&&!t,nt=o.useCallback(()=>{const a=e.default??null;C(a),u({value:a,source:{fromUi:!0}})},[e]);It({element:e,widgetMgr:r,onFormCleared:nt});const at=a=>{const{value:d}=a.target;if(d==="")T(!0),C(null),S(null);else{let y;e.dataType===I.DataType.INT?y=parseInt(d,10):y=parseFloat(d),T(!0),C(y),S(d)}},z=o.useCallback(()=>{v&&(T(!0),u({value:(i??b)+s,source:{fromUi:!0}}))},[i,b,s,v]),E=o.useCallback(()=>{V&&(T(!0),u({value:(i??m)-s,source:{fromUi:!0}}))},[i,m,s,V]),st=o.useCallback(a=>{const{key:d}=a;switch(d){case"ArrowUp":a.preventDefault(),z();break;case"ArrowDown":a.preventDefault(),E();break}},[z,E]),it=o.useCallback(a=>{a.key==="Enter"&&(g&&u({value:i,source:{fromUi:!0}}),r.allowFormEnterToSubmit(p)&&r.submitForm(p,l))},[g,i,u,r,p,l]);return N("div",{className:"stNumberInput","data-testid":"stNumberInput",style:{width:h},children:[c(mt,{label:e.label,disabled:t,labelVisibility:dt((O=e.labelVisibility)==null?void 0:O.value),htmlFor:L.current,children:e.help&&c(pt,{children:c(ft,{content:e.help,placement:bt.TOP_RIGHT})})}),N(Ct,{className:U?"focused":"","data-testid":"stNumberInputContainer",children:[c(Tt,{type:"number",inputRef:D,value:P??"",placeholder:e.placeholder,onBlur:ot,onFocus:rt,onChange:at,onKeyPress:it,onKeyDown:st,clearable:F,clearOnEscape:F,disabled:t,"aria-label":e.label,id:L.current,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:n.colors.darkGray,padding:n.spacing.threeXS,height:n.sizes.clearIconSize,width:n.sizes.clearIconSize,":hover":{fill:n.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:s,min:b,max:m,type:"number",inputMode:""},style:{lineHeight:n.lineHeights.inputWidget,paddingRight:n.spacing.sm,paddingLeft:n.spacing.sm,paddingBottom:n.spacing.sm,paddingTop:n.spacing.sm}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingRight:0}}}}),h>n.breakpoints.hideNumberInputControls&&N(wt,{children:[c(q,{"data-testid":"stNumberInputStepDown",onClick:E,disabled:!V||t,tabIndex:-1,children:c(M,{content:Q,size:"xs",color:V?"inherit":n.colors.disabled})}),c(q,{"data-testid":"stNumberInputStepUp",onClick:z,disabled:!v||t,tabIndex:-1,children:c(M,{content:Y,size:"xs",color:v?"inherit":n.colors.disabled})})]})]}),et&&c(St,{clearable:F,children:c(ht,{dirty:g,value:P??"",inForm:_,allowEnterToSubmit:tt})})]})},Ht=lt(Dt);export{Ht as default};
@@ -1 +1 @@
1
- import{n as s,k as r,r as i,j as n}from"./index.B7J6suR-.js";import{P as m,R as c}from"./RenderInPortalIfExists.Blpdplqk.js";const p=""+new URL("../media/balloon-0.Czj7AKwE.png",import.meta.url).href,f=""+new URL("../media/balloon-1.CNvFFrND.png",import.meta.url).href,d=""+new URL("../media/balloon-2.DTvC6B1t.png",import.meta.url).href,B=""+new URL("../media/balloon-3.CgSk4tbL.png",import.meta.url).href,L=""+new URL("../media/balloon-4.mbtFrzxf.png",import.meta.url).href,h=""+new URL("../media/balloon-5.CSwkUfRA.png",import.meta.url).href,t=300,a=121,e=20,g=80,u=1e3,x=r("from{transform:translateY(calc(100vh + ",t,"px));}to{transform:translateY(0);}"),_=s("img",{target:"eosrfo90"})(({theme:o})=>({position:"fixed",top:`${-t}px`,marginLeft:`${-a/2}px`,zIndex:o.zIndices.balloons,left:`${Math.random()*(g-e)+e}vw`,animationDelay:`${Math.random()*u}ms`,height:`${t}px`,width:`${a}px`,pointerEvents:"none",animationDuration:"750ms",animationName:x,animationTimingFunction:"ease-in",animationDirection:"normal",animationIterationCount:1,opacity:1})),w=30,l=[p,f,d,B,L,h],A=l.length,I=({particleType:o})=>n(_,{src:l[o]}),M=({scriptRunId:o})=>n(c,{children:n(m,{className:"stBalloons","data-testid":"stBalloons",scriptRunId:o,numParticleTypes:A,numParticles:w,ParticleComponent:I})}),S=i.memo(M);export{w as NUM_BALLOONS,S as default};
1
+ import{n as s,k as r,r as i,j as n}from"./index.DuqdUleB.js";import{P as m,R as c}from"./RenderInPortalIfExists.CGAGPcQq.js";const p=""+new URL("../media/balloon-0.Czj7AKwE.png",import.meta.url).href,f=""+new URL("../media/balloon-1.CNvFFrND.png",import.meta.url).href,d=""+new URL("../media/balloon-2.DTvC6B1t.png",import.meta.url).href,B=""+new URL("../media/balloon-3.CgSk4tbL.png",import.meta.url).href,L=""+new URL("../media/balloon-4.mbtFrzxf.png",import.meta.url).href,h=""+new URL("../media/balloon-5.CSwkUfRA.png",import.meta.url).href,t=300,a=121,e=20,g=80,u=1e3,x=r("from{transform:translateY(calc(100vh + ",t,"px));}to{transform:translateY(0);}"),_=s("img",{target:"eosrfo90"})(({theme:o})=>({position:"fixed",top:`${-t}px`,marginLeft:`${-a/2}px`,zIndex:o.zIndices.balloons,left:`${Math.random()*(g-e)+e}vw`,animationDelay:`${Math.random()*u}ms`,height:`${t}px`,width:`${a}px`,pointerEvents:"none",animationDuration:"750ms",animationName:x,animationTimingFunction:"ease-in",animationDirection:"normal",animationIterationCount:1,opacity:1})),w=30,l=[p,f,d,B,L,h],A=l.length,I=({particleType:o})=>n(_,{src:l[o]}),M=({scriptRunId:o})=>n(c,{children:n(m,{className:"stBalloons","data-testid":"stBalloons",scriptRunId:o,numParticleTypes:A,numParticles:w,ParticleComponent:I})}),S=i.memo(M);export{w as NUM_BALLOONS,S as default};
@@ -0,0 +1 @@
1
+ import{n as r,bn as S,i as x,R as d,j as o,c4 as u,z as f,aE as g}from"./index.DuqdUleB.js";const $=r(S,{shouldForwardProp:x,target:"e1xotax90"})(({theme:e})=>({fontSize:e.fontSizes.sm,width:e.sizes.spinnerSize,height:e.sizes.spinnerSize,borderWidth:e.sizes.spinnerThickness,justifyContents:"center",padding:e.spacing.none,margin:e.spacing.none,borderColor:e.colors.borderColor,borderTopColor:e.colors.secondary,flexGrow:0,flexShrink:0})),m=r("div",{target:"e1xotax91"})(({theme:e,width:t,cache:n})=>({width:t,...n?{paddingBottom:e.spacing.lg,background:`linear-gradient(to bottom, ${e.colors.bgColor} 0%, ${e.colors.bgColor} 80%, transparent 100%)`}:null})),T=r("div",{target:"e1xotax92"})(({theme:e})=>({opacity:.6,fontSize:e.fontSizes.sm})),h=r("div",{target:"e1xotax93"})(({theme:e})=>({display:"flex",gap:e.spacing.sm,alignItems:"center",width:"100%"})),y=e=>{const t=Math.floor(e/3600),n=Math.floor(e%3600/60),s=e%60;if(t===0&&n===0)return`(${s.toFixed(1)} seconds)`;if(t===0){const l=`${n} minute${n===1?"":"s"}`,p=s===0?"":`, ${s.toFixed(1)} seconds`;return`(${l}${p})`}const i=`${t} hour${t===1?"":"s"}`,a=n===0?"":`, ${n} minute${n===1?"":"s"}`,c=s===0?"":`, ${s.toFixed(1)} seconds`;return`(${i}${a}${c})`};function b({width:e,element:t}){const{cache:n,showTime:s}=t,[i,a]=d.useState(0);return d.useEffect(()=>{if(!s)return;const c=setInterval(()=>{a(l=>l+.1)},100);return()=>clearInterval(c)},[s]),o(m,{className:u({stSpinner:!0,stCacheSpinner:n}),"data-testid":"stSpinner",width:e,cache:n,children:f(h,{children:[o($,{}),o(g,{source:t.text,allowHTML:!1}),s&&o(T,{children:y(i)})]})})}export{b as default};
@@ -1,4 +1,4 @@
1
- import{bx as w,r as g,bK as ae,bL as T,bM as x,y as le,C as ce,j as S,bN as se,ay as ue,z as de,bt as fe,aE as ge,bC as he,bu as be,bd as me,bO as ve,bP as pe}from"./index.B7J6suR-.js";import{a as ye}from"./useBasicWidgetState.DXLMTaiS.js";import"./FormClearHelper.BgwPD1tD.js";var C=Object.freeze({default:"default",toggle:"toggle",toggle_round:"toggle"}),$e=Object.freeze({top:"top",right:"right",bottom:"bottom",left:"left"});function q(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),o.push.apply(o,r)}return o}function P(e){for(var t=1;t<arguments.length;t++){var o=arguments[t]!=null?arguments[t]:{};t%2?q(Object(o),!0).forEach(function(r){G(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):q(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function G(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function ke(e){var t=e.$disabled,o=e.$checked,r=e.$error,i=e.$isIndeterminate,l=e.$theme,n=e.$isFocusVisible,c=l.colors;return t?c.tickFillDisabled:o||i?"transparent":r?c.borderNegative:n?c.borderSelected:c.tickBorder}function Te(e){var t=e.$labelPlacement,o=t===void 0?"":t,r=e.$theme,i=r.sizing,l=i.scale300,n;switch(o){case"top":n="Bottom";break;case"bottom":n="Top";break;case"left":n="Right";break;default:case"right":n="Left";break}return r.direction==="rtl"&&n==="Left"?n="Right":r.direction==="rtl"&&n==="Right"&&(n="Left"),G({},"padding".concat(n),l)}function xe(e){var t=e.$disabled,o=e.$checked,r=e.$isIndeterminate,i=e.$error,l=e.$isHovered,n=e.$isActive,c=e.$theme,a=c.colors;return t?o||r?a.tickFillDisabled:a.tickFill:i&&(r||o)?n?a.tickFillErrorSelectedHoverActive:l?a.tickFillErrorSelectedHover:a.tickFillErrorSelected:i?n?a.tickFillErrorHoverActive:l?a.tickFillErrorHover:a.tickFillError:r||o?n?a.tickFillSelectedHoverActive:l?a.tickFillSelectedHover:a.tickFillSelected:n?a.tickFillActive:l?a.tickFillHover:a.tickFill}function we(e){var t=e.$disabled,o=e.$theme,r=o.colors;return t?r.contentSecondary:r.contentPrimary}var M=w("label",function(e){var t=e.$disabled,o=e.$labelPlacement;return{flexDirection:o==="top"||o==="bottom"?"column":"row",display:"flex",alignItems:o==="top"||o==="bottom"?"center":"flex-start",cursor:t?"not-allowed":"pointer",userSelect:"none"}});M.displayName="Root";M.displayName="Root";var _=w("span",function(e){var t=e.$checked,o=e.$disabled,r=e.$error,i=e.$isIndeterminate,l=e.$theme,n=e.$isFocusVisible,c=l.sizing,a=l.animation,s=o?l.colors.tickMarkFillDisabled:r?l.colors.tickMarkFillError:l.colors.tickMarkFill,$=encodeURIComponent(`
1
+ import{bw as x,r as g,bJ as ae,bK as T,bL as w,y as le,C as ce,j as S,bM as se,ay as ue,z as de,bs as fe,aE as ge,bB as he,bt as be,bc as me,bN as ve,bO as pe}from"./index.DuqdUleB.js";import{a as ye}from"./useBasicWidgetState.D572sX2t.js";import"./FormClearHelper.Bue0QSIn.js";var L=Object.freeze({default:"default",toggle:"toggle",toggle_round:"toggle"}),$e=Object.freeze({top:"top",right:"right",bottom:"bottom",left:"left"});function q(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),o.push.apply(o,r)}return o}function P(e){for(var t=1;t<arguments.length;t++){var o=arguments[t]!=null?arguments[t]:{};t%2?q(Object(o),!0).forEach(function(r){G(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):q(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function G(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function ke(e){var t=e.$disabled,o=e.$checked,r=e.$error,i=e.$isIndeterminate,l=e.$theme,n=e.$isFocusVisible,c=l.colors;return t?c.tickFillDisabled:o||i?"transparent":r?c.borderNegative:n?c.borderSelected:c.tickBorder}function Te(e){var t=e.$labelPlacement,o=t===void 0?"":t,r=e.$theme,i=r.sizing,l=i.scale300,n;switch(o){case"top":n="Bottom";break;case"bottom":n="Top";break;case"left":n="Right";break;default:case"right":n="Left";break}return r.direction==="rtl"&&n==="Left"?n="Right":r.direction==="rtl"&&n==="Right"&&(n="Left"),G({},"padding".concat(n),l)}function we(e){var t=e.$disabled,o=e.$checked,r=e.$isIndeterminate,i=e.$error,l=e.$isHovered,n=e.$isActive,c=e.$theme,a=c.colors;return t?o||r?a.tickFillDisabled:a.tickFill:i&&(r||o)?n?a.tickFillErrorSelectedHoverActive:l?a.tickFillErrorSelectedHover:a.tickFillErrorSelected:i?n?a.tickFillErrorHoverActive:l?a.tickFillErrorHover:a.tickFillError:r||o?n?a.tickFillSelectedHoverActive:l?a.tickFillSelectedHover:a.tickFillSelected:n?a.tickFillActive:l?a.tickFillHover:a.tickFill}function xe(e){var t=e.$disabled,o=e.$theme,r=o.colors;return t?r.contentSecondary:r.contentPrimary}var M=x("label",function(e){var t=e.$disabled,o=e.$labelPlacement;return{flexDirection:o==="top"||o==="bottom"?"column":"row",display:"flex",alignItems:o==="top"||o==="bottom"?"center":"flex-start",cursor:t?"not-allowed":"pointer",userSelect:"none"}});M.displayName="Root";M.displayName="Root";var _=x("span",function(e){var t=e.$checked,o=e.$disabled,r=e.$error,i=e.$isIndeterminate,l=e.$theme,n=e.$isFocusVisible,c=l.sizing,a=l.animation,s=o?l.colors.tickMarkFillDisabled:r?l.colors.tickMarkFillError:l.colors.tickMarkFill,$=encodeURIComponent(`
2
2
  <svg width="14" height="4" viewBox="0 0 14 4" fill="none" xmlns="http://www.w3.org/2000/svg">
3
3
  <path d="M14 0.5H0V3.5H14V0.5Z" fill="`.concat(s,`"/>
4
4
  </svg>
@@ -6,4 +6,4 @@ import{bx as w,r as g,bK as ae,bL as T,bM as x,y as le,C as ce,j as S,bN as se,a
6
6
  <svg width="17" height="13" viewBox="0 0 17 13" fill="none" xmlns="http://www.w3.org/2000/svg">
7
7
  <path d="M6.50002 12.6L0.400024 6.60002L2.60002 4.40002L6.50002 8.40002L13.9 0.900024L16.1 3.10002L6.50002 12.6Z" fill="`.concat(s,`"/>
8
8
  </svg>
9
- `)),h=l.borders.checkboxBorderRadius,b=ke(e);return{flex:"0 0 auto",transitionDuration:a.timing200,transitionTimingFunction:a.easeOutCurve,transitionProperty:"background-image, border-color, background-color",width:c.scale700,height:c.scale700,left:"4px",top:"4px",boxSizing:"border-box",borderLeftStyle:"solid",borderRightStyle:"solid",borderTopStyle:"solid",borderBottomStyle:"solid",borderLeftWidth:"3px",borderRightWidth:"3px",borderTopWidth:"3px",borderBottomWidth:"3px",borderLeftColor:b,borderRightColor:b,borderTopColor:b,borderBottomColor:b,borderTopLeftRadius:h,borderTopRightRadius:h,borderBottomRightRadius:h,borderBottomLeftRadius:h,outline:n&&t?"3px solid ".concat(l.colors.accent):"none",display:"inline-block",verticalAlign:"middle",backgroundImage:i?"url('data:image/svg+xml,".concat($,"');"):t?"url('data:image/svg+xml,".concat(u,"');"):null,backgroundColor:xe(e),backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"contain",marginTop:l.sizing.scale0,marginBottom:l.sizing.scale0,marginLeft:l.sizing.scale0,marginRight:l.sizing.scale0}});_.displayName="Checkmark";_.displayName="Checkmark";var I=w("div",function(e){var t=e.$theme,o=t.typography;return P(P(P({verticalAlign:"middle"},Te(e)),{},{color:we(e)},o.LabelMedium),{},{lineHeight:"24px"})});I.displayName="Label";I.displayName="Label";var z=w("input",{opacity:0,width:0,height:0,overflow:"hidden",margin:0,padding:0,position:"absolute"});z.displayName="Input";z.displayName="Input";var H=w("div",function(e){var t=e.$theme.colors.toggleFill;return e.$disabled?t=e.$theme.colors.toggleFillDisabled:e.$checked&&e.$error?t=e.$theme.colors.tickFillErrorSelected:e.$checked&&(t=e.$theme.colors.toggleFillChecked),{backgroundColor:t,borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(e.$theme.colors.accent):e.$isHovered&&!e.$disabled?e.$theme.lighting.shadow500:e.$theme.lighting.shadow400,outline:"none",height:e.$theme.sizing.scale700,width:e.$theme.sizing.scale700,transform:e.$checked?"translateX(".concat(e.$theme.direction==="rtl"?"-100%":"100%",")"):null,transition:"transform ".concat(e.$theme.animation.timing200)}});H.displayName="Toggle";H.displayName="Toggle";var D=w("div",function(e){var t=e.$theme.colors.toggleTrackFill;return e.$disabled?t=e.$theme.colors.toggleTrackFillDisabled:e.$error&&e.$checked&&(t=e.$theme.colors.tickFillError),{alignItems:"center",backgroundColor:t,borderTopLeftRadius:"7px",borderTopRightRadius:"7px",borderBottomRightRadius:"7px",borderBottomLeftRadius:"7px",display:"flex",height:e.$theme.sizing.scale550,marginTop:e.$theme.sizing.scale200,marginBottom:e.$theme.sizing.scale100,marginLeft:e.$theme.sizing.scale200,marginRight:e.$theme.sizing.scale100,width:e.$theme.sizing.scale1000}});D.displayName="ToggleTrack";D.displayName="ToggleTrack";function E(e){"@babel/helpers - typeof";return E=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},E(e)}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},y.apply(this,arguments)}function Re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Se(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ce(e,t,o){return t&&Se(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Le(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&B(e,t)}function B(e,t){return B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},B(e,t)}function Fe(e){var t=Pe();return function(){var r=L(e),i;if(t){var l=L(this).constructor;i=Reflect.construct(r,arguments,l)}else i=r.apply(this,arguments);return Oe(this,i)}}function Oe(e,t){if(t&&(E(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}function v(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pe(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function L(e){return L=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},L(e)}function p(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var Ee=function(t){return t.stopPropagation()},K=function(e){Le(o,e);var t=Fe(o);function o(){var r;Re(this,o);for(var i=arguments.length,l=new Array(i),n=0;n<i;n++)l[n]=arguments[n];return r=t.call.apply(t,[this].concat(l)),p(v(r),"state",{isFocused:r.props.autoFocus||!1,isFocusVisible:!1,isHovered:!1,isActive:!1}),p(v(r),"onMouseEnter",function(c){r.setState({isHovered:!0}),r.props.onMouseEnter(c)}),p(v(r),"onMouseLeave",function(c){r.setState({isHovered:!1,isActive:!1}),r.props.onMouseLeave(c)}),p(v(r),"onMouseDown",function(c){r.setState({isActive:!0}),r.props.onMouseDown(c)}),p(v(r),"onMouseUp",function(c){r.setState({isActive:!1}),r.props.onMouseUp(c)}),p(v(r),"onFocus",function(c){r.setState({isFocused:!0}),r.props.onFocus(c),ae(c)&&r.setState({isFocusVisible:!0})}),p(v(r),"onBlur",function(c){r.setState({isFocused:!1}),r.props.onBlur(c),r.state.isFocusVisible!==!1&&r.setState({isFocusVisible:!1})}),r}return Ce(o,[{key:"componentDidMount",value:function(){var i=this.props,l=i.autoFocus,n=i.inputRef;l&&n.current&&n.current.focus()}},{key:"render",value:function(){var i=this.props,l=i.overrides,n=l===void 0?{}:l,c=i.onChange,a=i.labelPlacement,s=a===void 0?this.props.checkmarkType===C.toggle?"left":"right":a,$=i.inputRef,u=i.isIndeterminate,h=i.error,b=i.disabled,R=i.value,f=i.name,m=i.type,d=i.checked,F=i.children,O=i.required,Y=i.title,j=n.Root,V=n.Checkmark,W=n.Label,N=n.Input,A=n.Toggle,U=n.ToggleTrack,Z=T(j)||M,J=T(V)||_,Q=T(W)||I,ee=T(N)||z,te=T(A)||H,re=T(U)||D,oe={onChange:c,onFocus:this.onFocus,onBlur:this.onBlur},ie={onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},k={$isFocused:this.state.isFocused,$isFocusVisible:this.state.isFocusVisible,$isHovered:this.state.isHovered,$isActive:this.state.isActive,$error:h,$checked:d,$isIndeterminate:u,$required:O,$disabled:b,$value:R},X=F&&g.createElement(Q,y({$labelPlacement:s},k,x(W)),this.props.containsInteractiveElement?g.createElement("div",{onClick:function(ne){return ne.preventDefault()}},F):F);return g.createElement(Z,y({"data-baseweb":"checkbox",title:Y||null,$labelPlacement:s},k,ie,x(j)),(s==="top"||s==="left")&&X,this.props.checkmarkType===C.toggle?g.createElement(re,y({},k,x(U)),g.createElement(te,y({},k,x(A)))):g.createElement(J,y({},k,x(V))),g.createElement(ee,y({value:R,name:f,checked:d,required:O,"aria-label":this.props["aria-label"]||this.props.ariaLabel,"aria-checked":u?"mixed":d,"aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":h||null,"aria-required":O||null,disabled:b,type:m,ref:$,onClick:Ee},k,oe,x(N))),(s==="bottom"||s==="right")&&X)}}]),o}(g.Component);p(K,"defaultProps",{overrides:{},checked:!1,containsInteractiveElement:!1,disabled:!1,autoFocus:!1,isIndeterminate:!1,inputRef:g.createRef(),error:!1,type:"checkbox",checkmarkType:C.default,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});function Be({width:e,element:t,disabled:o,widgetMgr:r,fragmentId:i}){var R;const[l,n]=ye({getStateFromWidgetMgr:Me,getDefaultStateFromProto:_e,getCurrStateFromProto:Ie,updateWidgetMgrState:ze,element:t,widgetMgr:r,fragmentId:i}),c=g.useCallback(f=>{n({value:f.target.checked,fromUi:!0})},[n]),a=le(),{colors:s,spacing:$,sizes:u}=a,h=ce(a),b=o?s.fadedText40:s.bodyText;return S(pe,{className:"row-widget stCheckbox","data-testid":"stCheckbox",width:e,children:S(K,{checked:l,disabled:o,onChange:c,"aria-label":t.label,checkmarkType:t.type===se.StyleType.TOGGLE?C.toggle:C.default,labelPlacement:$e.right,overrides:{Root:{style:({$isFocusVisible:f})=>({marginBottom:$.none,marginTop:$.none,backgroundColor:f?s.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:f})=>{let m=h?s.bgColor:s.bodyText;return o&&(m=h?s.gray70:s.gray90),{width:`calc(${u.checkbox} - ${a.spacing.twoXS})`,height:`calc(${u.checkbox} - ${a.spacing.twoXS})`,transform:f?`translateX(${u.checkbox})`:"",backgroundColor:m,boxShadow:""}}},ToggleTrack:{style:({$checked:f,$isHovered:m})=>{let d=s.fadedText40;return m&&!o&&(d=s.fadedText20),f&&!o&&(d=s.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:a.spacing.twoXS,paddingLeft:a.spacing.threeXS,paddingRight:a.spacing.threeXS,width:`calc(2 * ${u.checkbox})`,minWidth:`calc(2 * ${u.checkbox})`,height:u.checkbox,minHeight:u.checkbox,borderBottomLeftRadius:a.radii.full,borderTopLeftRadius:a.radii.full,borderBottomRightRadius:a.radii.full,borderTopRightRadius:a.radii.full,backgroundColor:d}}},Checkmark:{style:({$isFocusVisible:f,$checked:m})=>{const d=m&&!o?s.primary:s.fadedText40;return{outline:0,width:u.checkbox,height:u.checkbox,marginTop:a.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:f&&m?`0 0 0 0.2rem ${ue(s.primary,.5)}`:"",borderLeftWidth:u.borderWidth,borderRightWidth:u.borderWidth,borderTopWidth:u.borderWidth,borderBottomWidth:u.borderWidth,borderLeftColor:d,borderRightColor:d,borderTopColor:d,borderBottomColor:d}}},Label:{style:{lineHeight:a.lineHeights.small,paddingLeft:a.spacing.sm,position:"relative",color:b}}},children:de(ve,{visibility:fe((R=t.labelVisibility)==null?void 0:R.value),"data-testid":"stWidgetLabel",children:[S(ge,{source:t.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),t.help&&S(he,{color:b,children:S(be,{content:t.help,placement:me.TOP_RIGHT})})]})})})}function Me(e,t){return e.getBoolValue(t)}function _e(e){return e.default??null}function Ie(e){return e.value??null}function ze(e,t,o,r){t.setBoolValue(e,o.value,{fromUi:o.fromUi},r)}const We=g.memo(Be);export{We as default};
9
+ `)),h=l.borders.checkboxBorderRadius,b=ke(e);return{flex:"0 0 auto",transitionDuration:a.timing200,transitionTimingFunction:a.easeOutCurve,transitionProperty:"background-image, border-color, background-color",width:c.scale700,height:c.scale700,left:"4px",top:"4px",boxSizing:"border-box",borderLeftStyle:"solid",borderRightStyle:"solid",borderTopStyle:"solid",borderBottomStyle:"solid",borderLeftWidth:"3px",borderRightWidth:"3px",borderTopWidth:"3px",borderBottomWidth:"3px",borderLeftColor:b,borderRightColor:b,borderTopColor:b,borderBottomColor:b,borderTopLeftRadius:h,borderTopRightRadius:h,borderBottomRightRadius:h,borderBottomLeftRadius:h,outline:n&&t?"3px solid ".concat(l.colors.accent):"none",display:"inline-block",verticalAlign:"middle",backgroundImage:i?"url('data:image/svg+xml,".concat($,"');"):t?"url('data:image/svg+xml,".concat(u,"');"):null,backgroundColor:we(e),backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"contain",marginTop:l.sizing.scale0,marginBottom:l.sizing.scale0,marginLeft:l.sizing.scale0,marginRight:l.sizing.scale0}});_.displayName="Checkmark";_.displayName="Checkmark";var I=x("div",function(e){var t=e.$theme,o=t.typography;return P(P(P({verticalAlign:"middle"},Te(e)),{},{color:xe(e)},o.LabelMedium),{},{lineHeight:"24px"})});I.displayName="Label";I.displayName="Label";var z=x("input",{opacity:0,width:0,height:0,overflow:"hidden",margin:0,padding:0,position:"absolute"});z.displayName="Input";z.displayName="Input";var H=x("div",function(e){var t=e.$theme.colors.toggleFill;return e.$disabled?t=e.$theme.colors.toggleFillDisabled:e.$checked&&e.$error?t=e.$theme.colors.tickFillErrorSelected:e.$checked&&(t=e.$theme.colors.toggleFillChecked),{backgroundColor:t,borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(e.$theme.colors.accent):e.$isHovered&&!e.$disabled?e.$theme.lighting.shadow500:e.$theme.lighting.shadow400,outline:"none",height:e.$theme.sizing.scale700,width:e.$theme.sizing.scale700,transform:e.$checked?"translateX(".concat(e.$theme.direction==="rtl"?"-100%":"100%",")"):null,transition:"transform ".concat(e.$theme.animation.timing200)}});H.displayName="Toggle";H.displayName="Toggle";var D=x("div",function(e){var t=e.$theme.colors.toggleTrackFill;return e.$disabled?t=e.$theme.colors.toggleTrackFillDisabled:e.$error&&e.$checked&&(t=e.$theme.colors.tickFillError),{alignItems:"center",backgroundColor:t,borderTopLeftRadius:"7px",borderTopRightRadius:"7px",borderBottomRightRadius:"7px",borderBottomLeftRadius:"7px",display:"flex",height:e.$theme.sizing.scale550,marginTop:e.$theme.sizing.scale200,marginBottom:e.$theme.sizing.scale100,marginLeft:e.$theme.sizing.scale200,marginRight:e.$theme.sizing.scale100,width:e.$theme.sizing.scale1000}});D.displayName="ToggleTrack";D.displayName="ToggleTrack";function E(e){"@babel/helpers - typeof";return E=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},E(e)}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},y.apply(this,arguments)}function Re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Se(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Le(e,t,o){return t&&Se(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ce(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&B(e,t)}function B(e,t){return B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},B(e,t)}function Fe(e){var t=Pe();return function(){var r=C(e),i;if(t){var l=C(this).constructor;i=Reflect.construct(r,arguments,l)}else i=r.apply(this,arguments);return Oe(this,i)}}function Oe(e,t){if(t&&(E(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}function v(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pe(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},C(e)}function p(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var Ee=function(t){return t.stopPropagation()},K=function(e){Ce(o,e);var t=Fe(o);function o(){var r;Re(this,o);for(var i=arguments.length,l=new Array(i),n=0;n<i;n++)l[n]=arguments[n];return r=t.call.apply(t,[this].concat(l)),p(v(r),"state",{isFocused:r.props.autoFocus||!1,isFocusVisible:!1,isHovered:!1,isActive:!1}),p(v(r),"onMouseEnter",function(c){r.setState({isHovered:!0}),r.props.onMouseEnter(c)}),p(v(r),"onMouseLeave",function(c){r.setState({isHovered:!1,isActive:!1}),r.props.onMouseLeave(c)}),p(v(r),"onMouseDown",function(c){r.setState({isActive:!0}),r.props.onMouseDown(c)}),p(v(r),"onMouseUp",function(c){r.setState({isActive:!1}),r.props.onMouseUp(c)}),p(v(r),"onFocus",function(c){r.setState({isFocused:!0}),r.props.onFocus(c),ae(c)&&r.setState({isFocusVisible:!0})}),p(v(r),"onBlur",function(c){r.setState({isFocused:!1}),r.props.onBlur(c),r.state.isFocusVisible!==!1&&r.setState({isFocusVisible:!1})}),r}return Le(o,[{key:"componentDidMount",value:function(){var i=this.props,l=i.autoFocus,n=i.inputRef;l&&n.current&&n.current.focus()}},{key:"render",value:function(){var i=this.props,l=i.overrides,n=l===void 0?{}:l,c=i.onChange,a=i.labelPlacement,s=a===void 0?this.props.checkmarkType===L.toggle?"left":"right":a,$=i.inputRef,u=i.isIndeterminate,h=i.error,b=i.disabled,R=i.value,f=i.name,m=i.type,d=i.checked,F=i.children,O=i.required,Y=i.title,j=n.Root,V=n.Checkmark,W=n.Label,N=n.Input,A=n.Toggle,U=n.ToggleTrack,Z=T(j)||M,J=T(V)||_,Q=T(W)||I,ee=T(N)||z,te=T(A)||H,re=T(U)||D,oe={onChange:c,onFocus:this.onFocus,onBlur:this.onBlur},ie={onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},k={$isFocused:this.state.isFocused,$isFocusVisible:this.state.isFocusVisible,$isHovered:this.state.isHovered,$isActive:this.state.isActive,$error:h,$checked:d,$isIndeterminate:u,$required:O,$disabled:b,$value:R},X=F&&g.createElement(Q,y({$labelPlacement:s},k,w(W)),this.props.containsInteractiveElement?g.createElement("div",{onClick:function(ne){return ne.preventDefault()}},F):F);return g.createElement(Z,y({"data-baseweb":"checkbox",title:Y||null,$labelPlacement:s},k,ie,w(j)),(s==="top"||s==="left")&&X,this.props.checkmarkType===L.toggle?g.createElement(re,y({},k,w(U)),g.createElement(te,y({},k,w(A)))):g.createElement(J,y({},k,w(V))),g.createElement(ee,y({value:R,name:f,checked:d,required:O,"aria-label":this.props["aria-label"]||this.props.ariaLabel,"aria-checked":u?"mixed":d,"aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":h||null,"aria-required":O||null,disabled:b,type:m,ref:$,onClick:Ee},k,oe,w(N))),(s==="bottom"||s==="right")&&X)}}]),o}(g.Component);p(K,"defaultProps",{overrides:{},checked:!1,containsInteractiveElement:!1,disabled:!1,autoFocus:!1,isIndeterminate:!1,inputRef:g.createRef(),error:!1,type:"checkbox",checkmarkType:L.default,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});function Be({width:e,element:t,disabled:o,widgetMgr:r,fragmentId:i}){var R;const[l,n]=ye({getStateFromWidgetMgr:Me,getDefaultStateFromProto:_e,getCurrStateFromProto:Ie,updateWidgetMgrState:ze,element:t,widgetMgr:r,fragmentId:i}),c=g.useCallback(f=>{n({value:f.target.checked,fromUi:!0})},[n]),a=le(),{colors:s,spacing:$,sizes:u}=a,h=ce(a),b=o?s.fadedText40:s.bodyText;return S(pe,{className:"row-widget stCheckbox","data-testid":"stCheckbox",width:e,children:S(K,{checked:l,disabled:o,onChange:c,"aria-label":t.label,checkmarkType:t.type===se.StyleType.TOGGLE?L.toggle:L.default,labelPlacement:$e.right,overrides:{Root:{style:({$isFocusVisible:f})=>({marginBottom:$.none,marginTop:$.none,backgroundColor:f?s.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:f})=>{let m=h?s.bgColor:s.bodyText;return o&&(m=h?s.gray70:s.gray90),{width:`calc(${u.checkbox} - ${a.spacing.twoXS})`,height:`calc(${u.checkbox} - ${a.spacing.twoXS})`,transform:f?`translateX(${u.checkbox})`:"",backgroundColor:m,boxShadow:""}}},ToggleTrack:{style:({$checked:f,$isHovered:m})=>{let d=s.fadedText40;return m&&!o&&(d=s.fadedText20),f&&!o&&(d=s.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:a.spacing.twoXS,paddingLeft:a.spacing.threeXS,paddingRight:a.spacing.threeXS,width:`calc(2 * ${u.checkbox})`,minWidth:`calc(2 * ${u.checkbox})`,height:u.checkbox,minHeight:u.checkbox,borderBottomLeftRadius:a.radii.full,borderTopLeftRadius:a.radii.full,borderBottomRightRadius:a.radii.full,borderTopRightRadius:a.radii.full,backgroundColor:d}}},Checkmark:{style:({$isFocusVisible:f,$checked:m})=>{const d=m&&!o?s.primary:s.fadedText40;return{outline:0,width:u.checkbox,height:u.checkbox,marginTop:a.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:f&&m?`0 0 0 0.2rem ${ue(s.primary,.5)}`:"",borderLeftWidth:u.borderWidth,borderRightWidth:u.borderWidth,borderTopWidth:u.borderWidth,borderBottomWidth:u.borderWidth,borderLeftColor:d,borderRightColor:d,borderTopColor:d,borderBottomColor:d}}},Label:{style:{lineHeight:a.lineHeights.small,paddingLeft:a.spacing.sm,position:"relative",color:b}}},children:de(ve,{visibility:fe((R=t.labelVisibility)==null?void 0:R.value),"data-testid":"stWidgetLabel",children:[S(ge,{source:t.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),t.help&&S(he,{color:b,children:S(be,{content:t.help,placement:me.TOP_RIGHT})})]})})})}function Me(e,t){return e.getBoolValue(t)}function _e(e){return e.default??null}function Ie(e){return e.value??null}function ze(e,t,o,r){t.setBoolValue(e,o.value,{fromUi:o.fromUi},r)}const We=g.memo(Be);export{We as default};
@@ -1 +1 @@
1
- import{n as o,z as m,j as i,aE as S}from"./index.B7J6suR-.js";import{S as g,T as y}from"./Toolbar.DMhyNpv2.js";import{w as W,u as b,E as M}from"./withFullScreenWrapper.BLLyDFUF.js";const E=o("div",{target:"evl31sl0"})(({theme:t})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:t.spacing.lg,maxWidth:"100%",width:"fit-content"})),L=o("div",{target:"evl31sl1"})(({theme:t})=>({display:"flex",flexDirection:"column",alignItems:"stretch",width:"auto",flexGrow:0,">img":{borderRadius:t.radii.default}})),O=o("div",{target:"evl31sl2"})(({theme:t})=>({textAlign:"center",marginTop:t.spacing.xs,wordWrap:"break-word",padding:t.spacing.threeXS}));var p;(function(t){t[t.OriginalWidth=-1]="OriginalWidth",t[t.ColumnWidth=-2]="ColumnWidth",t[t.AutoWidth=-3]="AutoWidth",t[t.MinImageOrContainer=-4]="MinImageOrContainer",t[t.MaxImageOrContainer=-5]="MaxImageOrContainer"})(p||(p={}));function T({element:t,width:u,endpoints:f,disableFullscreenMode:x}){const{expanded:n,width:w,height:r,expand:C,collapse:h}=b(M),d=n?w:u;let l;const a=t.width;if([-1,-3,-4].includes(a))l=void 0;else if([-2,-5].includes(a))l=d;else if(a>0)l=a;else throw Error(`Invalid image width: ${a}`);const e={};return r&&n?(e.maxHeight=r,e.objectFit="contain"):(e.width=l,e.maxWidth="100%"),m(g,{width:d,height:r,useContainerWidth:n,topCentered:!0,children:[i(y,{target:g,isFullScreen:n,onExpand:C,onCollapse:h,disableFullscreenMode:x}),i(E,{className:"stImage","data-testid":"stImage",children:t.imgs.map((I,c)=>{const s=I;return m(L,{"data-testid":"stImageContainer",children:[i("img",{style:e,src:f.buildMediaURL(s.url),alt:c.toString()}),s.caption&&i(O,{"data-testid":"stImageCaption",style:e,children:i(S,{source:s.caption,allowHTML:!1,isCaption:!0,isLabel:!0})})]},c)})})]})}const R=W(T);export{R as default};
1
+ import{n as o,z as m,j as i,aE as S}from"./index.DuqdUleB.js";import{S as g,T as y}from"./Toolbar.DBtrI961.js";import{w as W,u as b,E as M}from"./withFullScreenWrapper.4QDrgZxA.js";const E=o("div",{target:"evl31sl0"})(({theme:t})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:t.spacing.lg,maxWidth:"100%",width:"fit-content"})),L=o("div",{target:"evl31sl1"})(({theme:t})=>({display:"flex",flexDirection:"column",alignItems:"stretch",width:"auto",flexGrow:0,">img":{borderRadius:t.radii.default}})),O=o("div",{target:"evl31sl2"})(({theme:t})=>({textAlign:"center",marginTop:t.spacing.xs,wordWrap:"break-word",padding:t.spacing.threeXS}));var p;(function(t){t[t.OriginalWidth=-1]="OriginalWidth",t[t.ColumnWidth=-2]="ColumnWidth",t[t.AutoWidth=-3]="AutoWidth",t[t.MinImageOrContainer=-4]="MinImageOrContainer",t[t.MaxImageOrContainer=-5]="MaxImageOrContainer"})(p||(p={}));function T({element:t,width:u,endpoints:f,disableFullscreenMode:x}){const{expanded:n,width:w,height:r,expand:C,collapse:h}=b(M),d=n?w:u;let l;const a=t.width;if([-1,-3,-4].includes(a))l=void 0;else if([-2,-5].includes(a))l=d;else if(a>0)l=a;else throw Error(`Invalid image width: ${a}`);const e={};return r&&n?(e.maxHeight=r,e.objectFit="contain"):(e.width=l,e.maxWidth="100%"),m(g,{width:d,height:r,useContainerWidth:n,topCentered:!0,children:[i(y,{target:g,isFullScreen:n,onExpand:C,onCollapse:h,disableFullscreenMode:x}),i(E,{className:"stImage","data-testid":"stImage",children:t.imgs.map((I,c)=>{const s=I;return m(L,{"data-testid":"stImageContainer",children:[i("img",{style:e,src:f.buildMediaURL(s.url),alt:c.toString()}),s.caption&&i(O,{"data-testid":"stImageCaption",style:e,children:i(S,{source:s.caption,allowHTML:!1,isCaption:!0,isLabel:!0})})]},c)})})]})}const R=W(T);export{R as default};
@@ -1 +1 @@
1
- import{n as p,aR as w,r as a,z as x,j as r,D as v,aE as h,aS as e,aT as k,aU as z,F as R,C as L}from"./index.B7J6suR-.js";const C=p("button",{target:"e1rpgzpk0"})(({theme:o})=>({fontSize:o.fontSizes.sm,lineHeight:o.lineHeights.base,color:o.colors.fadedText60,backgroundColor:o.colors.transparent,fontFamily:"inherit",margin:o.spacing.none,border:"none",boxShadow:"none",padding:o.spacing.none,"&:hover, &:active, &:focus":{border:"none",outline:"none",boxShadow:"none"},"&:hover":{color:o.colors.primary}})),B=p("div",{target:"e1rpgzpk1"})(({theme:o})=>({display:"flex",flexDirection:"row",gap:o.spacing.lg,"> span":{marginTop:o.spacing.twoXS}})),E=p("div",{target:"e1rpgzpk3"})(({theme:o})=>({display:"flex",flexDirection:"column",gap:o.spacing.sm,alignItems:"start",justifyContent:"center",overflow:"hidden",minHeight:"100%",fontSize:o.fontSizes.sm,lineHeight:o.lineHeights.base,div:{display:"inline-flex"}}));function m(o){const t=L(o);return{Body:{props:{"data-testid":"stToast",className:"stToast"},style:{display:"flex",flexDirection:"row",gap:o.spacing.md,width:o.sizes.toastWidth,marginTop:o.spacing.sm,borderTopLeftRadius:o.radii.default,borderTopRightRadius:o.radii.default,borderBottomLeftRadius:o.radii.default,borderBottomRightRadius:o.radii.default,paddingTop:o.spacing.lg,paddingBottom:o.spacing.lg,paddingLeft:o.spacing.twoXL,paddingRight:o.spacing.twoXL,backgroundColor:t?o.colors.gray10:o.colors.gray90,color:o.colors.bodyText,boxShadow:t?"0px 4px 16px rgba(0, 0, 0, 0.16)":"0px 4px 16px rgba(0, 0, 0, 0.7)"}},CloseIcon:{style:{color:o.colors.fadedText40,width:o.fontSizes.lg,height:o.fontSizes.lg,marginRight:`calc(-1 * ${o.spacing.lg} / 2)`,":hover":{color:o.colors.bodyText}}}}}function D(o){if(o.length>104){let s=o.replace(/^(.{104}[^\s]*).*/,"$1");return s.length>104&&(s=s.substring(0,104).split(" ").slice(0,-1).join(" ")),s.trim()}return o}function H({theme:o,body:t,icon:s,width:y}){const n=D(t),d=t!==n,[i,b]=a.useState(!d),[u,S]=a.useState(0),f=a.useCallback(()=>{b(!i)},[i]),c=a.useMemo(()=>m(o),[o]),l=a.useMemo(()=>x(B,{expanded:i,children:[s&&r(v,{iconValue:s,size:"xl",testid:"stToastDynamicIcon"}),x(E,{children:[r(h,{source:i?t:n,allowHTML:!1,isToast:!0}),d&&r(C,{"data-testid":"stToastViewButton",onClick:f,children:i?"view less":"view more"})]})]}),[d,i,t,s,n,f]);a.useEffect(()=>{if(o.inSidebar)return;const g=e.info(l,{overrides:{...c}});return S(g),()=>{e.update(g,{overrides:{Body:{style:{transitionDuration:0}}}}),e.clear(g)}},[]),a.useEffect(()=>{e.update(u,{children:l,overrides:{...c}})},[u,l,c]);const T=r(z,{kind:k.ERROR,body:"Streamlit API Error: `st.toast` cannot be called directly on the sidebar with `st.sidebar.toast`. See our `st.toast` API [docs](https://docs.streamlit.io/develop/api-reference/status/st.toast) for more information.",width:y});return r(R,{children:o.inSidebar&&T})}const M=w(H);export{M as default};
1
+ import{n as p,aR as w,r as a,z as x,j as r,D as v,aE as h,aS as e,aT as k,aU as z,F as R,C as L}from"./index.DuqdUleB.js";const C=p("button",{target:"e1rpgzpk0"})(({theme:o})=>({fontSize:o.fontSizes.sm,lineHeight:o.lineHeights.base,color:o.colors.fadedText60,backgroundColor:o.colors.transparent,fontFamily:"inherit",margin:o.spacing.none,border:"none",boxShadow:"none",padding:o.spacing.none,"&:hover, &:active, &:focus":{border:"none",outline:"none",boxShadow:"none"},"&:hover":{color:o.colors.primary}})),B=p("div",{target:"e1rpgzpk1"})(({theme:o})=>({display:"flex",flexDirection:"row",gap:o.spacing.lg,"> span":{marginTop:o.spacing.twoXS}})),E=p("div",{target:"e1rpgzpk3"})(({theme:o})=>({display:"flex",flexDirection:"column",gap:o.spacing.sm,alignItems:"start",justifyContent:"center",overflow:"hidden",minHeight:"100%",fontSize:o.fontSizes.sm,lineHeight:o.lineHeights.base,div:{display:"inline-flex"}}));function m(o){const t=L(o);return{Body:{props:{"data-testid":"stToast",className:"stToast"},style:{display:"flex",flexDirection:"row",gap:o.spacing.md,width:o.sizes.toastWidth,marginTop:o.spacing.sm,borderTopLeftRadius:o.radii.default,borderTopRightRadius:o.radii.default,borderBottomLeftRadius:o.radii.default,borderBottomRightRadius:o.radii.default,paddingTop:o.spacing.lg,paddingBottom:o.spacing.lg,paddingLeft:o.spacing.twoXL,paddingRight:o.spacing.twoXL,backgroundColor:t?o.colors.gray10:o.colors.gray90,color:o.colors.bodyText,boxShadow:t?"0px 4px 16px rgba(0, 0, 0, 0.16)":"0px 4px 16px rgba(0, 0, 0, 0.7)"}},CloseIcon:{style:{color:o.colors.fadedText40,width:o.fontSizes.lg,height:o.fontSizes.lg,marginRight:`calc(-1 * ${o.spacing.lg} / 2)`,":hover":{color:o.colors.bodyText}}}}}function D(o){if(o.length>104){let s=o.replace(/^(.{104}[^\s]*).*/,"$1");return s.length>104&&(s=s.substring(0,104).split(" ").slice(0,-1).join(" ")),s.trim()}return o}function H({theme:o,body:t,icon:s,width:y}){const n=D(t),d=t!==n,[i,b]=a.useState(!d),[u,S]=a.useState(0),f=a.useCallback(()=>{b(!i)},[i]),c=a.useMemo(()=>m(o),[o]),l=a.useMemo(()=>x(B,{expanded:i,children:[s&&r(v,{iconValue:s,size:"xl",testid:"stToastDynamicIcon"}),x(E,{children:[r(h,{source:i?t:n,allowHTML:!1,isToast:!0}),d&&r(C,{"data-testid":"stToastViewButton",onClick:f,children:i?"view less":"view more"})]})]}),[d,i,t,s,n,f]);a.useEffect(()=>{if(o.inSidebar)return;const g=e.info(l,{overrides:{...c}});return S(g),()=>{e.update(g,{overrides:{Body:{style:{transitionDuration:0}}}}),e.clear(g)}},[]),a.useEffect(()=>{e.update(u,{children:l,overrides:{...c}})},[u,l,c]);const T=r(z,{kind:k.ERROR,body:"Streamlit API Error: `st.toast` cannot be called directly on the sidebar with `st.sidebar.toast`. See our `st.toast` API [docs](https://docs.streamlit.io/develop/api-reference/status/st.toast) for more information.",width:y});return r(R,{children:o.inSidebar&&T})}const M=w(H);export{M as default};
@@ -0,0 +1 @@
1
+ import{n as f,r as a,j as c}from"./index.DuqdUleB.js";const E=f("div",{target:"ea9qfvi0"})(()=>({lineHeight:0})),y=f("audio",{target:"ea9qfvi1"})(({theme:t})=>({width:"100%",height:t.sizes.minElementHeight,margin:0,padding:0}));function A({element:t,endpoints:l,elementMgr:o}){const i=a.useRef(null),{startTime:n,endTime:d,loop:u,autoplay:p}=t,m=a.useMemo(()=>{if(!t.id)return!0;const e=o.getElementState(t.id,"preventAutoplay");return e||o.setElementState(t.id,"preventAutoplay",!0),e??!1},[t.id,o]);a.useEffect(()=>{i.current&&(i.current.currentTime=n)},[n]),a.useEffect(()=>{const e=i.current,r=()=>{e&&(e.currentTime=t.startTime)};return e&&e.addEventListener("loadedmetadata",r),()=>{e&&e.removeEventListener("loadedmetadata",r)}},[t]),a.useEffect(()=>{const e=i.current;if(!e)return;let r=!1;const s=()=>{d>0&&e.currentTime>=d&&(u?(e.currentTime=n||0,e.play()):r||(r=!0,e.pause()))};return d>0&&e.addEventListener("timeupdate",s),()=>{e&&d>0&&e.removeEventListener("timeupdate",s)}},[d,u,n]),a.useEffect(()=>{const e=i.current;if(!e)return;const r=()=>{u&&(e.currentTime=n||0,e.play())};return e.addEventListener("ended",r),()=>{e&&e.removeEventListener("ended",r)}},[u,n]);const v=l.buildMediaURL(t.url);return c(E,{children:c(y,{className:"stAudio","data-testid":"stAudio",ref:i,controls:!0,autoPlay:p&&!m,src:v})})}export{A as default};
@@ -0,0 +1 @@
1
+ import{n as e,z as t,j as r,aE as o}from"./index.DuqdUleB.js";import{P as i}from"./ProgressBar.B_WJAIyy.js";const l=e("div",{target:"e1675qd10"})(({theme:s})=>({paddingBottom:s.spacing.sm,lineHeight:"normal"}));function g({element:s,width:a}){return t("div",{className:"stProgress","data-testid":"stProgress",children:[r(l,{children:r(o,{source:s.text,allowHTML:!1,isLabel:!0})}),r(i,{value:s.value,width:a})]})}export{g as default};
@@ -0,0 +1 @@
1
+ import{r as h,E as V,_ as z,n as w,z as p,j as r,b8 as y,bp as g,co as E,bq as U,cp as L,a_ as B,F as k,R as N,aC as W,bk as T,J as u,bm as D,bl as H,bs as A,bF as R,bt as _,bc as $,bu as O}from"./index.DuqdUleB.js";import{a as S}from"./axios.upsvKRUO.js";import{F as X}from"./FormClearHelper.Bue0QSIn.js";import{S as x,I as q,b as G,c as J,d as K,C as j,e as Q,f as Y,h as Z,i as ee,g as b,F as f,j as te,k as se,l as ie,s as le,m as ae,n as re}from"./FileDropzone.BFkJKygp.js";import{S as ne,P as oe}from"./ProgressBar.B_WJAIyy.js";import{u as de}from"./Hooks.kV16_k1-.js";import{U as m}from"./UploadFileInfo.C-jY39rj.js";var C=h.forwardRef(function(l,o){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement(V,z({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},l,{ref:o}),h.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))});C.displayName="Error";const ce=w("div",{target:"egc9vxm0"})(({theme:l})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:l.spacing.twoXS,marginBottom:l.spacing.twoXS})),pe=w("div",{target:"egc9vxm1"})(({theme:l})=>({display:"flex",alignItems:"center",justifyContent:"center",color:l.colors.fadedText40})),ue=({currentPage:l,totalPages:o,onNext:e,onPrevious:t})=>p(ce,{"data-testid":"stFileUploaderPagination",children:[r(x,{children:`Showing page ${l} of ${o}`}),p(pe,{children:[r(U,{onClick:t,kind:y.MINIMAL,children:r(g,{content:E,size:"xl"})}),r(U,{onClick:e,kind:y.MINIMAL,children:r(g,{content:L,size:"xl"})})]})]}),I=(l,o)=>Math.ceil(l.length/o),he=l=>B(({pageSize:e,items:t,resetOnAdd:s,...a})=>{const[i,n]=h.useState(0),[d,F]=h.useState(I(t,e)),c=de(t);h.useEffect(()=>{c&&c.length!==t.length&&F(I(t,e)),c&&c.length<t.length?s&&n(0):i+1>=d&&n(d-1)},[t,i,e,c,s,d]);const v=()=>{n(Math.min(i+1,d-1))},M=()=>{n(Math.max(0,i-1))},P=t.slice(i*e,i*e+e);return p(k,{children:[r(l,{items:P,...a}),t.length>e?r(ue,{pageSize:e,totalPages:d,currentPage:i+1,onNext:v,onPrevious:M}):null]})},l),ge=({fileInfo:l})=>l.status.type==="uploading"?r(oe,{value:l.status.progress,size:ne.SMALL}):l.status.type==="error"?p(ee,{children:[r(Y,{"data-testid":"stFileUploaderFileErrorMessage",children:l.status.errorMessage}),r(Z,{children:r(g,{content:C,size:"lg"})})]}):l.status.type==="uploaded"?r(x,{children:b(l.size,f.Byte)}):null,me=({fileInfo:l,onDelete:o})=>p(Q,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[r(G,{children:r(g,{content:q,size:"twoXL"})}),p(J,{className:"stFileUploaderFileData",children:[r(K,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:l.name,children:l.name}),r(ge,{fileInfo:l})]}),r("div",{"data-testid":"stFileUploaderDeleteBtn",children:r(U,{onClick:()=>o(l.id),kind:y.MINIMAL,children:r(g,{content:j,size:"lg"})})})]}),fe=({items:l,onDelete:o})=>r(ie,{children:l.map(e=>r(se,{children:r(me,{fileInfo:e,onDelete:o})},e.id))}),Fe=he(fe),ye=l=>r(te,{children:r(Fe,{...l})});class ve extends N.PureComponent{constructor(o){super(o),this.formClearHelper=new X,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if(this.status!=="ready")return;const e=this.createWidgetValue(),{element:t,widgetMgr:s,fragmentId:a}=this.props,i=s.getFileUploaderStateValue(t);W(e,i)||s.setFileUploaderStateValue(t,e,{fromUi:!0},a)},this.reset=()=>{this.setState({files:[]})},this.dropHandler=(e,t)=>{const{element:s}=this.props,{multipleFiles:a}=s;if(!a&&e.length===0&&t.length>1){const i=t.findIndex(n=>n.errors.length===1&&n.errors[0].code==="too-many-files");i>=0&&(e.push(t[i].file),t.splice(i,1))}if(this.props.uploadClient.fetchFileURLs(e).then(i=>{if(!a&&e.length>0){const n=this.state.files.find(d=>d.status.type!=="error");n&&(this.forceUpdatingStatus=!0,this.deleteFile(n.id),this.forceUpdatingStatus=!1)}T(i,e).forEach(([n,d])=>{this.uploadFile(n,d)})}).catch(i=>{this.addFiles(e.map(n=>new m(n.name,n.size,this.nextLocalFileId(),{type:"error",errorMessage:i})))}),t.length>0){const i=t.map(n=>{const{file:d}=n;return new m(d.name,d.size,this.nextLocalFileId(),{type:"error",errorMessage:this.getErrorMessage(n.errors[0].code,n.file)})});this.addFiles(i)}},this.uploadFile=(e,t)=>{const s=S.CancelToken.source(),a=new m(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:s,progress:1});this.addFile(a),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,i=>this.onUploadProgress(i,a.id),s.token).then(()=>this.onUploadComplete(a.id,e)).catch(i=>{S.isCancel(i)||this.updateFile(a.id,a.setStatus({type:"error",errorMessage:i?i.toString():"Unknown error"}))})},this.onUploadComplete=(e,t)=>{const s=this.getFile(e);u(s)||s.status.type!=="uploading"||this.updateFile(s.id,s.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.getErrorMessage=(e,t)=>{switch(e){case"file-too-large":return`File must be ${b(this.maxUploadSizeInBytes,f.Byte)} or smaller.`;case"file-invalid-type":return`${t.type} files are not allowed.`;case"file-too-small":return"File size is too small.";case"too-many-files":return"Only one file is allowed.";default:return"Unexpected error. Please try again."}},this.deleteFile=e=>{const t=this.getFile(e);u(t)||(t.status.type==="uploading"&&t.status.cancelToken.cancel(),t.status.type==="uploaded"&&t.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(t.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState(t=>({files:[...t.files,e]}))},this.addFiles=e=>{this.setState(t=>({files:[...t.files,...e]}))},this.removeFile=e=>{this.setState(t=>({files:t.files.filter(s=>s.id!==e)}))},this.getFile=e=>this.state.files.find(t=>t.id===e),this.updateFile=(e,t)=>{this.setState(s=>({files:s.files.map(a=>a.id===e?t:a)}))},this.onUploadProgress=(e,t)=>{const s=this.getFile(t);if(u(s)||s.status.type!=="uploading")return;const a=Math.round(e.loaded*100/e.total);s.status.progress!==a&&this.updateFile(t,s.setStatus({type:"uploading",cancelToken:s.status.cancelToken,progress:a}))},this.onFormCleared=()=>{this.setState({files:[]},()=>{const e=this.createWidgetValue();if(u(e))return;const{widgetMgr:t,element:s,fragmentId:a}=this.props;t.setFileUploaderStateValue(s,e,{fromUi:!0},a)})},this.state=this.initialValue}get initialValue(){const o={files:[],newestServerFileId:0},{widgetMgr:e,element:t}=this.props,s=e.getFileUploaderStateValue(t);if(u(s))return o;const{uploadedFileInfo:a}=s;return u(a)||a.length===0?o:{files:a.map(i=>{const n=i.name,d=i.size,F=i.fileId,c=i.fileUrls;return new m(n,d,this.nextLocalFileId(),{type:"uploaded",fileId:F,fileUrls:c})})}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){const o=this.props.element.maxUploadSizeMb;return le(o,f.Megabyte,f.Byte)}get status(){const o=e=>e.status.type==="uploading";return this.state.files.some(o)||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const o=this.createWidgetValue(),{element:e,widgetMgr:t,fragmentId:s}=this.props;t.getFileUploaderStateValue(e)===void 0&&t.setFileUploaderStateValue(e,o,{fromUi:!1},s)}createWidgetValue(){const o=this.state.files.filter(e=>e.status.type==="uploaded").map(e=>{const{name:t,size:s,status:a}=e,{fileId:i,fileUrls:n}=a;return new D({fileId:i,fileUrls:n,name:t,size:s})});return new H({uploadedFileInfo:o})}render(){var d;const{files:o}=this.state,{element:e,disabled:t,widgetMgr:s,width:a}=this.props,i=e.type;this.formClearHelper.manageFormClearListener(s,e.formId,this.onFormCleared);const n=o.slice().reverse();return p(re,{className:"stFileUploader","data-testid":"stFileUploader",width:a,children:[r(O,{label:e.label,disabled:t,labelVisibility:A((d=e.labelVisibility)==null?void 0:d.value),children:e.help&&r(R,{children:r(_,{content:e.help,placement:$.TOP_RIGHT})})}),r(ae,{onDrop:this.dropHandler,multiple:e.multipleFiles,acceptedExtensions:i,maxSizeBytes:this.maxUploadSizeInBytes,label:e.label,disabled:t}),n.length>0&&r(ye,{items:n,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}export{ve as default};
@@ -1 +1 @@
1
- import{n as T,r,y as W,c1 as C,c2 as V,z as L,j as l,bt as O,bG as P,bu as k,bd as E,bv as N,c0 as $,c3 as B,bY as A,bE as F,c4 as H}from"./index.B7J6suR-.js";import{a as D}from"./useBasicWidgetState.DXLMTaiS.js";import"./FormClearHelper.BgwPD1tD.js";const G=T("div",{target:"euzcfsp0"})(({theme:s})=>({"span[aria-disabled='true']":{background:s.colors.fadedText05}})),U=(s,t)=>s.getIntArrayValue(t),j=s=>s.default??null,K=s=>s.value??null,Y=(s,t,a,u)=>{t.setIntArrayValue(s,a.value,{fromUi:a.fromUi},u)},_=s=>{var S;const{element:t,widgetMgr:a,width:u,fragmentId:y}=s,e=W(),[n,g]=D({getStateFromWidgetMgr:U,getDefaultStateFromProto:j,getCurrStateFromProto:K,updateWidgetMgrState:Y,element:t,widgetMgr:a,fragmentId:y}),m=t.maxSelections>0&&n.length>=t.maxSelections,f=r.useMemo(()=>{if(t.maxSelections===0)return"No results";if(n.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,n.length]),v=r.useMemo(()=>n.map(o=>{const i=t.options[o];return{value:o.toString(),label:i}}),[t.options,n]),h=r.useCallback(o=>{const i=()=>{var d;const p=(d=o.option)==null?void 0:d.value;return parseInt(p,10)};switch(o.type){case"remove":return C(n,i());case"clear":return[];case"select":return n.concat([i()]);default:throw new Error(`State transition is unknown: ${o.type}`)}},[n]),x=r.useCallback(o=>{t.maxSelections&&o.type==="select"&&n.length>=t.maxSelections||g({value:h(o),fromUi:!0})},[t.maxSelections,h,g,n.length]),z=r.useCallback((o,i)=>{if(m)return[];const p=o.filter(d=>!n.includes(Number(d.value)));return V(p,i)},[m,n]),w={width:u},{options:c}=t,b=c.length===0?!0:s.disabled,I=c.length===0?"No options to select.":t.placeholder,R=c.map((o,i)=>({label:o,value:i.toString()})),M=c.length>10;return L("div",{className:"stMultiSelect","data-testid":"stMultiSelect",style:w,children:[l(N,{label:t.label,disabled:b,labelVisibility:O((S=t.labelVisibility)==null?void 0:S.value),children:t.help&&l(P,{children:l(k,{content:t.help,placement:E.TOP_RIGHT})})}),l(G,{children:l($,{options:R,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:I,type:B.select,multi:!0,onChange:x,value:v,disabled:b,size:"compact",noResultsMsg:f,filterOptions:z,closeOnSelect:!1,overrides:{Popover:{props:{overrides:{Body:{style:()=>({marginTop:e.spacing.px})}}}},SelectArrow:{component:A,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",opacity:"0.7"})},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:F&&M===!1?"readonly":null}},Dropdown:{component:H}}})})]})},Q=r.memo(_);export{Q as default};
1
+ import{n as T,r,y as W,c0 as C,c1 as V,z as L,j as l,bs as O,bF as P,bt as $,bc as k,bu as N,b$ as B,c2 as E,bX as F,bD as A,c3 as D}from"./index.DuqdUleB.js";import{a as H}from"./useBasicWidgetState.D572sX2t.js";import"./FormClearHelper.Bue0QSIn.js";const U=T("div",{target:"euzcfsp0"})(({theme:s})=>({"span[aria-disabled='true']":{background:s.colors.fadedText05}})),j=(s,t)=>s.getIntArrayValue(t),G=s=>s.default??null,K=s=>s.value??null,X=(s,t,a,u)=>{t.setIntArrayValue(s,a.value,{fromUi:a.fromUi},u)},Y=s=>{var S;const{element:t,widgetMgr:a,width:u,fragmentId:y}=s,e=W(),[n,g]=H({getStateFromWidgetMgr:j,getDefaultStateFromProto:G,getCurrStateFromProto:K,updateWidgetMgrState:X,element:t,widgetMgr:a,fragmentId:y}),m=t.maxSelections>0&&n.length>=t.maxSelections,f=r.useMemo(()=>{if(t.maxSelections===0)return"No results";if(n.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,n.length]),v=r.useMemo(()=>n.map(o=>{const i=t.options[o];return{value:o.toString(),label:i}}),[t.options,n]),h=r.useCallback(o=>{const i=()=>{var d;const p=(d=o.option)==null?void 0:d.value;return parseInt(p,10)};switch(o.type){case"remove":return C(n,i());case"clear":return[];case"select":return n.concat([i()]);default:throw new Error(`State transition is unknown: ${o.type}`)}},[n]),x=r.useCallback(o=>{t.maxSelections&&o.type==="select"&&n.length>=t.maxSelections||g({value:h(o),fromUi:!0})},[t.maxSelections,h,g,n.length]),z=r.useCallback((o,i)=>{if(m)return[];const p=o.filter(d=>!n.includes(Number(d.value)));return V(p,i)},[m,n]),w={width:u},{options:c}=t,b=c.length===0?!0:s.disabled,I=c.length===0?"No options to select.":t.placeholder,R=c.map((o,i)=>({label:o,value:i.toString()})),M=c.length>10;return L("div",{className:"stMultiSelect","data-testid":"stMultiSelect",style:w,children:[l(N,{label:t.label,disabled:b,labelVisibility:O((S=t.labelVisibility)==null?void 0:S.value),children:t.help&&l(P,{children:l($,{content:t.help,placement:k.TOP_RIGHT})})}),l(U,{children:l(B,{options:R,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:I,type:E.select,multi:!0,onChange:x,value:v,disabled:b,size:"compact",noResultsMsg:f,filterOptions:z,closeOnSelect:!1,overrides:{Popover:{props:{overrides:{Body:{style:()=>({marginTop:e.spacing.px})}}}},SelectArrow:{component:F,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",opacity:"0.7"})},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:A&&M===!1?"readonly":null}},Dropdown:{component:D}}})})]})},Q=r.memo(Y);export{Q as default};
@@ -1 +1 @@
1
- import{n as c,b7 as v,ay as y,b8 as l,b9 as t,j as s,ba as C,bb as S}from"./index.B7J6suR-.js";function k(o,i){switch(o){case l.XSMALL:return{padding:`${i.spacing.twoXS} ${i.spacing.sm}`,fontSize:i.fontSizes.sm};case l.SMALL:return{padding:`${i.spacing.twoXS} ${i.spacing.md}`};case l.LARGE:return{padding:`${i.spacing.md} ${i.spacing.md}`};default:return{padding:`${i.spacing.xs} ${i.spacing.md}`}}}const g=c("a",{target:"efj1jhq0"})(({fluidWidth:o,size:i,theme:r})=>{const a=typeof o=="number"?`${o}px`:"100%";return{display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:r.fontWeights.normal,padding:`${r.spacing.xs} ${r.spacing.md}`,borderRadius:r.radii.default,minHeight:r.sizes.minElementHeight,margin:0,lineHeight:r.lineHeights.base,color:r.colors.primary,textDecoration:"none",width:o?a:"auto",userSelect:"none","&:visited":{color:r.colors.primary},"&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${y(r.colors.primary,.5)}`},"&:hover":{textDecoration:"none"},"&:active":{textDecoration:"none"},...k(i,r)}}),B=c(g,{target:"efj1jhq1"})(({theme:o})=>({backgroundColor:o.colors.primary,color:o.colors.white,border:`${o.sizes.borderWidth} solid ${o.colors.primary}`,"&:hover":{backgroundColor:v(o.colors.primary,.05),color:o.colors.white},"&:active":{backgroundColor:"transparent",color:o.colors.primary},"&:visited:not(:active)":{color:o.colors.white},"&[disabled], &[disabled]:hover, &[disabled]:active, &[disabled]:visited":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),x=c(g,{target:"efj1jhq2"})(({theme:o})=>({backgroundColor:o.colors.lightenedBg05,color:o.colors.bodyText,border:`${o.sizes.borderWidth} solid ${o.colors.borderColor}`,"&:visited":{color:o.colors.bodyText},"&:hover":{borderColor:o.colors.primary,color:o.colors.primary},"&:active":{color:o.colors.white,borderColor:o.colors.primary,backgroundColor:o.colors.primary},"&:focus:not(:active)":{borderColor:o.colors.primary,color:o.colors.primary},"&[disabled], &[disabled]:hover, &[disabled]:active":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),$=c(g,{target:"efj1jhq3"})(({theme:o})=>({padding:o.spacing.none,backgroundColor:o.colors.transparent,color:o.colors.bodyText,border:"none","&:visited":{color:o.colors.bodyText},"&:hover":{color:o.colors.primary},"&:active":{color:o.colors.primary},"&:focus":{outline:"none"},"&:focus-visible":{color:o.colors.primary,boxShadow:`0 0 0 0.2rem ${y(o.colors.primary,.5)}`},"&[disabled], &[disabled]:hover, &[disabled]:active":{backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}}));function L({kind:o,size:i,disabled:r,fluidWidth:a,children:d,autoFocus:n,href:e,rel:b,target:u,onClick:f}){let p=B;return o===t.SECONDARY?p=x:o===t.TERTIARY&&(p=$),s(p,{kind:o,size:i||l.MEDIUM,fluidWidth:a||!1,disabled:r||!1,autoFocus:n||!1,href:e,target:u,rel:b,onClick:f,tabIndex:r?-1:0,"data-testid":`stBaseLinkButton-${o}`,children:d})}function T(o){const{disabled:i,element:r,width:a}=o,d={width:a};let n=t.SECONDARY;r.type==="primary"?n=t.PRIMARY:r.type==="tertiary"&&(n=t.TERTIARY);const e=r.help?a:!0,b=u=>{o.disabled&&u.preventDefault()};return s("div",{className:"stLinkButton","data-testid":"stLinkButton",style:d,children:s(C,{help:r.help,children:s(L,{kind:n,size:l.SMALL,disabled:i,onClick:b,fluidWidth:r.useContainerWidth?e:!1,href:r.url,target:"_blank",rel:"noreferrer","aria-disabled":i,children:s(S,{icon:r.icon,label:r.label})})})})}export{T as default};
1
+ import{n as c,b6 as v,ay as y,b7 as l,b8 as t,j as s,b9 as C,ba as S}from"./index.DuqdUleB.js";function k(o,i){switch(o){case l.XSMALL:return{padding:`${i.spacing.twoXS} ${i.spacing.sm}`,fontSize:i.fontSizes.sm};case l.SMALL:return{padding:`${i.spacing.twoXS} ${i.spacing.md}`};case l.LARGE:return{padding:`${i.spacing.md} ${i.spacing.md}`};default:return{padding:`${i.spacing.xs} ${i.spacing.md}`}}}const g=c("a",{target:"efj1jhq0"})(({fluidWidth:o,size:i,theme:r})=>{const a=typeof o=="number"?`${o}px`:"100%";return{display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:r.fontWeights.normal,padding:`${r.spacing.xs} ${r.spacing.md}`,borderRadius:r.radii.default,minHeight:r.sizes.minElementHeight,margin:0,lineHeight:r.lineHeights.base,color:r.colors.primary,textDecoration:"none",width:o?a:"auto",userSelect:"none","&:visited":{color:r.colors.primary},"&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${y(r.colors.primary,.5)}`},"&:hover":{textDecoration:"none"},"&:active":{textDecoration:"none"},...k(i,r)}}),B=c(g,{target:"efj1jhq1"})(({theme:o})=>({backgroundColor:o.colors.primary,color:o.colors.white,border:`${o.sizes.borderWidth} solid ${o.colors.primary}`,"&:hover":{backgroundColor:v(o.colors.primary,.05),color:o.colors.white},"&:active":{backgroundColor:"transparent",color:o.colors.primary},"&:visited:not(:active)":{color:o.colors.white},"&[disabled], &[disabled]:hover, &[disabled]:active, &[disabled]:visited":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),x=c(g,{target:"efj1jhq2"})(({theme:o})=>({backgroundColor:o.colors.lightenedBg05,color:o.colors.bodyText,border:`${o.sizes.borderWidth} solid ${o.colors.borderColor}`,"&:visited":{color:o.colors.bodyText},"&:hover":{borderColor:o.colors.primary,color:o.colors.primary},"&:active":{color:o.colors.white,borderColor:o.colors.primary,backgroundColor:o.colors.primary},"&:focus:not(:active)":{borderColor:o.colors.primary,color:o.colors.primary},"&[disabled], &[disabled]:hover, &[disabled]:active":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),$=c(g,{target:"efj1jhq3"})(({theme:o})=>({padding:o.spacing.none,backgroundColor:o.colors.transparent,color:o.colors.bodyText,border:"none","&:visited":{color:o.colors.bodyText},"&:hover":{color:o.colors.primary},"&:active":{color:o.colors.primary},"&:focus":{outline:"none"},"&:focus-visible":{color:o.colors.primary,boxShadow:`0 0 0 0.2rem ${y(o.colors.primary,.5)}`},"&[disabled], &[disabled]:hover, &[disabled]:active":{backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}}));function L({kind:o,size:i,disabled:r,fluidWidth:a,children:d,autoFocus:n,href:e,rel:u,target:b,onClick:f}){let p=B;return o===t.SECONDARY?p=x:o===t.TERTIARY&&(p=$),s(p,{kind:o,size:i||l.MEDIUM,fluidWidth:a||!1,disabled:r||!1,autoFocus:n||!1,href:e,target:b,rel:u,onClick:f,tabIndex:r?-1:0,"data-testid":`stBaseLinkButton-${o}`,children:d})}function T(o){const{disabled:i,element:r,width:a}=o,d={width:a};let n=t.SECONDARY;r.type==="primary"?n=t.PRIMARY:r.type==="tertiary"&&(n=t.TERTIARY);const e=r.help?a:!0,u=b=>{o.disabled&&b.preventDefault()};return s("div",{className:"stLinkButton","data-testid":"stLinkButton",style:d,children:s(C,{help:r.help,children:s(L,{kind:n,size:l.SMALL,disabled:i,onClick:u,fluidWidth:r.useContainerWidth?e:!1,href:r.url,target:"_blank",rel:"noreferrer","aria-disabled":i,children:s(S,{icon:r.icon,label:r.label})})})})}export{T as default};
@@ -1 +1 @@
1
- import{n as U,r as s,bk as V,j as l}from"./index.B7J6suR-.js";const P=U("iframe",{target:"eymnmwl0"})(({theme:a})=>({colorScheme:"normal",border:"none",padding:a.spacing.none,margin:a.spacing.none,width:"100%",aspectRatio:"16 / 9"})),R=528;function w({element:a,width:f,endpoints:m,elementMgr:c}){const i=s.useRef(null),{type:E,url:p,startTime:n,subtitles:y,endTime:d,loop:u,autoplay:T,muted:h}=a,S=s.useMemo(()=>{if(!a.id)return!0;const e=c.getElementState(a.id,"preventAutoplay");return e||c.setElementState(a.id,"preventAutoplay",!0),e??!1},[a.id,c]);s.useEffect(()=>{i.current&&(i.current.currentTime=n)},[n]),s.useEffect(()=>{const e=i.current,t=()=>{e&&(e.currentTime=a.startTime)};return e&&e.addEventListener("loadedmetadata",t),()=>{e&&e.removeEventListener("loadedmetadata",t)}},[a]),s.useEffect(()=>{const e=i.current;if(!e)return;let t=!1;const o=()=>{d>0&&e.currentTime>=d&&(u?(e.currentTime=n||0,e.play()):t||(t=!0,e.pause()))};return d>0&&e.addEventListener("timeupdate",o),()=>{e&&d>0&&e.removeEventListener("timeupdate",o)}},[d,u,n]),s.useEffect(()=>{const e=i.current;if(!e)return;const t=()=>{u&&(e.currentTime=n||0,e.play())};return e.addEventListener("ended",t),()=>{e&&e.removeEventListener("ended",t)}},[u,n]);const g=e=>{const{startTime:t,endTime:o,loop:L,autoplay:N,muted:b}=a,r=new URL(e);if(t&&!isNaN(t)&&r.searchParams.append("start",t.toString()),o&&!isNaN(o)&&r.searchParams.append("end",o.toString()),L){r.searchParams.append("loop","1");const v=r.pathname.split("/").pop();v&&r.searchParams.append("playlist",v)}return N&&r.searchParams.append("autoplay","1"),b&&r.searchParams.append("mute","1"),r.toString()};return E===V.Type.YOUTUBE_IFRAME?l(P,{className:"stVideo","data-testid":"stVideo",title:p,src:g(p),allow:"autoplay; encrypted-media",allowFullScreen:!0}):l("video",{className:"stVideo","data-testid":"stVideo",ref:i,controls:!0,muted:h,autoPlay:T&&!S,src:m.buildMediaURL(p),style:{width:f,height:f===0?R:void 0},crossOrigin:void 0,children:y&&y.map((e,t)=>l("track",{kind:"captions",src:m.buildMediaURL(`${e.url}`),label:`${e.label}`,default:t===0},t))})}export{w as default};
1
+ import{n as U,r as s,bj as V,j as l}from"./index.DuqdUleB.js";const P=U("iframe",{target:"eymnmwl0"})(({theme:a})=>({colorScheme:"normal",border:"none",padding:a.spacing.none,margin:a.spacing.none,width:"100%",aspectRatio:"16 / 9"})),R=528;function w({element:a,width:f,endpoints:m,elementMgr:c}){const i=s.useRef(null),{type:E,url:p,startTime:n,subtitles:y,endTime:d,loop:u,autoplay:T,muted:h}=a,S=s.useMemo(()=>{if(!a.id)return!0;const e=c.getElementState(a.id,"preventAutoplay");return e||c.setElementState(a.id,"preventAutoplay",!0),e??!1},[a.id,c]);s.useEffect(()=>{i.current&&(i.current.currentTime=n)},[n]),s.useEffect(()=>{const e=i.current,t=()=>{e&&(e.currentTime=a.startTime)};return e&&e.addEventListener("loadedmetadata",t),()=>{e&&e.removeEventListener("loadedmetadata",t)}},[a]),s.useEffect(()=>{const e=i.current;if(!e)return;let t=!1;const o=()=>{d>0&&e.currentTime>=d&&(u?(e.currentTime=n||0,e.play()):t||(t=!0,e.pause()))};return d>0&&e.addEventListener("timeupdate",o),()=>{e&&d>0&&e.removeEventListener("timeupdate",o)}},[d,u,n]),s.useEffect(()=>{const e=i.current;if(!e)return;const t=()=>{u&&(e.currentTime=n||0,e.play())};return e.addEventListener("ended",t),()=>{e&&e.removeEventListener("ended",t)}},[u,n]);const g=e=>{const{startTime:t,endTime:o,loop:L,autoplay:N,muted:b}=a,r=new URL(e);if(t&&!isNaN(t)&&r.searchParams.append("start",t.toString()),o&&!isNaN(o)&&r.searchParams.append("end",o.toString()),L){r.searchParams.append("loop","1");const v=r.pathname.split("/").pop();v&&r.searchParams.append("playlist",v)}return N&&r.searchParams.append("autoplay","1"),b&&r.searchParams.append("mute","1"),r.toString()};return E===V.Type.YOUTUBE_IFRAME?l(P,{className:"stVideo","data-testid":"stVideo",title:p,src:g(p),allow:"autoplay; encrypted-media",allowFullScreen:!0}):l("video",{className:"stVideo","data-testid":"stVideo",ref:i,controls:!0,muted:h,autoPlay:T&&!S,src:m.buildMediaURL(p),style:{width:f,height:f===0?R:void 0},crossOrigin:void 0,children:y&&y.map((e,t)=>l("track",{kind:"captions",src:m.buildMediaURL(`${e.url}`),label:`${e.label}`,default:t===0},t))})}export{w as default};
@@ -0,0 +1 @@
1
+ import{r as i,j as g,bs as b,bP as m}from"./index.DuqdUleB.js";import{a as f}from"./useBasicWidgetState.D572sX2t.js";import"./FormClearHelper.Bue0QSIn.js";const p=(t,e)=>t.getStringValue(e),C=t=>t.default??null,d=t=>t.value??null,P=(t,e,r,o)=>{e.setStringValue(t,r.value,{fromUi:r.fromUi},o)},S=({element:t,disabled:e,widgetMgr:r,width:o,fragmentId:s})=>{var l;const[u,a]=f({getStateFromWidgetMgr:p,getDefaultStateFromProto:C,getCurrStateFromProto:d,updateWidgetMgrState:P,element:t,widgetMgr:r,fragmentId:s}),n=i.useCallback(c=>{a({value:c,fromUi:!0})},[a]);return g(m,{label:t.label,labelVisibility:b((l=t.labelVisibility)==null?void 0:l.value),help:t.help,onChange:n,disabled:e,width:o,value:u})},v=i.memo(S);export{v as default};
@@ -1,4 +1,4 @@
1
- import{r as reactExports,j as jsx}from"./index.B7J6suR-.js";/*!
1
+ import{r as reactExports,j as jsx}from"./index.DuqdUleB.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 s,y as U,cs as T,z as k,j as l,bt as A,bG as L,bu as P,bd as B,bv as D}from"./index.B7J6suR-.js";import{u as j}from"./uniqueId.CndDhnid.js";import{u as _,a as G,b as K}from"./useOnInputChange.CvHbHWmy.js";import{I as O}from"./InputInstructions.qlsk9gvt.js";import{a as $}from"./useBasicWidgetState.DXLMTaiS.js";import{T as q}from"./textarea.CUrV8-V3.js";import"./inputUtils.CQWz5UKz.js";import"./FormClearHelper.BgwPD1tD.js";import"./base-input.DyTEaESI.js";const W=(a,t)=>a.getStringValue(t)??t.default??null,N=a=>a.default??null,w=a=>a.value??null,J=(a,t,o,u)=>{t.setStringValue(a,o.value,{fromUi:o.fromUi},u)},Q=({disabled:a,element:t,widgetMgr:o,fragmentId:u,width:h})=>{var x;const b=s.useRef(j("text_area_")).current,[r,n]=s.useState(!1),[S,g]=s.useState(!1),[i,d]=s.useState(W(o,t)??null),y=s.useCallback(()=>{d(t.default??null),n(!0)},[t]),[I,c]=$({getStateFromWidgetMgr:W,getDefaultStateFromProto:N,getCurrStateFromProto:w,updateWidgetMgrState:J,element:t,widgetMgr:o,fragmentId:u,onFormCleared:y});_(I,i,d,r);const e=U(),p=s.useCallback(()=>{n(!1),c({value:i,fromUi:!0})},[i,c]),V=s.useCallback(()=>{r&&p(),g(!1)},[r,p]),C=s.useCallback(()=>{g(!0)},[]),F=G({formId:t.formId,maxChars:t.maxChars,setDirty:n,setUiValue:d,setValueWithSource:c}),v=K(t.formId,p,r,o,u,!0),z={width:h},{height:f,placeholder:E,formId:m}=t,H=T({formId:m})?o.allowFormEnterToSubmit(m):r,R=S&&h>e.breakpoints.hideWidgetDetails;return k("div",{className:"stTextArea","data-testid":"stTextArea",style:z,children:[l(D,{label:t.label,disabled:a,labelVisibility:A((x=t.labelVisibility)==null?void 0:x.value),htmlFor:b,children:t.help&&l(L,{children:l(P,{content:t.help,placement:B.TOP_RIGHT})})}),l(q,{value:i??"",placeholder:E,onBlur:V,onFocus:C,onChange:F,onKeyDown:v,"aria-label":t.label,disabled:a,id:b,overrides:{Input:{style:{lineHeight:e.lineHeights.inputWidget,height:f?`${f}px`:"",minHeight:e.sizes.largestElementHeight,resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:e.spacing.lg,paddingLeft:e.spacing.lg,paddingBottom:e.spacing.lg,paddingTop:e.spacing.lg}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:{borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth}}}}),R&&l(O,{dirty:r,value:i??"",maxLength:t.maxChars,type:"multiline",inForm:T({formId:m}),allowEnterToSubmit:H})]})},rt=s.memo(Q);export{rt as default};
1
+ import{r as s,y as U,cq as T,z as k,j as l,bs as A,bF as L,bt as P,bc as B,bu as D}from"./index.DuqdUleB.js";import{u as j}from"./uniqueId.CVe3uxKs.js";import{u as _,a as q,b as K}from"./useOnInputChange.D9rTVyjn.js";import{I as O}from"./InputInstructions.DpG38kbY.js";import{a as $}from"./useBasicWidgetState.D572sX2t.js";import{T as G}from"./textarea.CmSZv6UE.js";import"./inputUtils.CQWz5UKz.js";import"./FormClearHelper.Bue0QSIn.js";import"./base-input.P8VGAZdC.js";const W=(a,t)=>a.getStringValue(t)??t.default??null,N=a=>a.default??null,w=a=>a.value??null,J=(a,t,o,u)=>{t.setStringValue(a,o.value,{fromUi:o.fromUi},u)},Q=({disabled:a,element:t,widgetMgr:o,fragmentId:u,width:h})=>{var x;const b=s.useRef(j("text_area_")).current,[r,n]=s.useState(!1),[S,g]=s.useState(!1),[i,d]=s.useState(W(o,t)??null),y=s.useCallback(()=>{d(t.default??null),n(!0)},[t]),[I,c]=$({getStateFromWidgetMgr:W,getDefaultStateFromProto:N,getCurrStateFromProto:w,updateWidgetMgrState:J,element:t,widgetMgr:o,fragmentId:u,onFormCleared:y});_(I,i,d,r);const e=U(),p=s.useCallback(()=>{n(!1),c({value:i,fromUi:!0})},[i,c]),F=s.useCallback(()=>{r&&p(),g(!1)},[r,p]),V=s.useCallback(()=>{g(!0)},[]),C=q({formId:t.formId,maxChars:t.maxChars,setDirty:n,setUiValue:d,setValueWithSource:c}),v=K(t.formId,p,r,o,u,!0),z={width:h},{height:f,placeholder:E,formId:m}=t,H=T({formId:m})?o.allowFormEnterToSubmit(m):r,R=S&&h>e.breakpoints.hideWidgetDetails;return k("div",{className:"stTextArea","data-testid":"stTextArea",style:z,children:[l(D,{label:t.label,disabled:a,labelVisibility:A((x=t.labelVisibility)==null?void 0:x.value),htmlFor:b,children:t.help&&l(L,{children:l(P,{content:t.help,placement:B.TOP_RIGHT})})}),l(G,{value:i??"",placeholder:E,onBlur:F,onFocus:V,onChange:C,onKeyDown:v,"aria-label":t.label,disabled:a,id:b,overrides:{Input:{style:{lineHeight:e.lineHeights.inputWidget,height:f?`${f}px`:"",minHeight:e.sizes.largestElementHeight,resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:e.spacing.lg,paddingLeft:e.spacing.lg,paddingBottom:e.spacing.lg,paddingTop:e.spacing.lg}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:{borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth}}}}),R&&l(O,{dirty:r,value:i??"",maxLength:t.maxChars,type:"multiline",inForm:T({formId:m}),allowEnterToSubmit:H})]})},rt=s.memo(Q);export{rt as default};
@@ -0,0 +1,73 @@
1
+ import{r as u,E as $,_ as H,a$ as ut,bk as Ht,bl as Vt,bm as jt,J as G,M as X,R as yt,aF as Gt,n as x,bn as Xt,z,j as v,bo as qt,b8 as Yt,bp as Jt,bq as Kt,al as Zt,y as Qt,br as Q,az as te,aC as ee,bs as ie,bt as se,bc as ne,bu as re}from"./index.DuqdUleB.js";import{u as oe,F as ae}from"./FormClearHelper.Bue0QSIn.js";import{T as le,a as pt}from"./Toolbar.DBtrI961.js";import{u as ce}from"./Hooks.kV16_k1-.js";import{c as de}from"./createDownloadLinkElement.DZMwyjvU.js";import{F as he,D as ue}from"./FileDownload.esm.ShSIWsKj.js";var wt=u.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),u.createElement("g",{fill:"none"},u.createElement("rect",{width:24,height:24}),u.createElement("rect",{width:24,height:24}),u.createElement("rect",{width:24,height:24})),u.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),u.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});wt.displayName="Mic";var Ct=u.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),u.createElement("rect",{width:24,height:24,fill:"none"}),u.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});Ct.displayName="Pause";var St=u.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),u.createElement("rect",{width:24,height:24,fill:"none"}),u.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});St.displayName="PlayArrow";var Rt=u.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),u.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),u.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});Rt.displayName="Refresh";var Et=u.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),u.createElement("g",{fill:"none"},u.createElement("rect",{width:24,height:24}),u.createElement("rect",{width:24,height:24})),u.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});Et.displayName="StopCircle";function E(s,t,e,i){return new(e||(e=Promise))(function(r,n){function a(c){try{d(i.next(c))}catch(l){n(l)}}function o(c){try{d(i.throw(c))}catch(l){n(l)}}function d(c){var l;c.done?r(c.value):(l=c.value,l instanceof e?l:new e(function(p){p(l)})).then(a,o)}d((i=i.apply(s,t||[])).next())})}let V=class{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),i==null?void 0:i.once){const r=()=>{this.un(t,r),this.un(t,e)};return this.on(t,r),r}return()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}};const mt={decode:function(s,t){return E(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});return e.decodeAudioData(s).finally(()=>e.close())})},createBuffer:function(s,t){return typeof s[0]=="number"&&(s=[s]),function(e){const i=e[0];if(i.some(r=>r>1||r<-1)){const r=i.length;let n=0;for(let a=0;a<r;a++){const o=Math.abs(i[a]);o>n&&(n=o)}for(const a of e)for(let o=0;o<r;o++)a[o]/=n}}(s),{duration:t,length:s[0].length,sampleRate:s[0].length/t,numberOfChannels:s.length,getChannelData:e=>s==null?void 0:s[e],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function xt(s,t){const e=t.xmlns?document.createElementNS(t.xmlns,s):document.createElement(s);for(const[i,r]of Object.entries(t))if(i==="children")for(const[n,a]of Object.entries(t))typeof a=="string"?e.appendChild(document.createTextNode(a)):e.appendChild(xt(n,a));else i==="style"?Object.assign(e.style,r):i==="textContent"?e.textContent=r:e.setAttribute(i,r.toString());return e}function ft(s,t,e){const i=xt(s,t||{});return e==null||e.appendChild(i),i}var pe=Object.freeze({__proto__:null,createElement:ft,default:ft});const me={fetchBlob:function(s,t,e){return E(this,void 0,void 0,function*(){const i=yield fetch(s,e);if(i.status>=400)throw new Error(`Failed to fetch ${s}: ${i.status} (${i.statusText})`);return function(r,n){E(this,void 0,void 0,function*(){if(!r.body||!r.headers)return;const a=r.body.getReader(),o=Number(r.headers.get("Content-Length"))||0;let d=0;const c=p=>E(this,void 0,void 0,function*(){d+=(p==null?void 0:p.length)||0;const h=Math.round(d/o*100);n(h)}),l=()=>E(this,void 0,void 0,function*(){let p;try{p=yield a.read()}catch{return}p.done||(c(p.value),yield l())});l()})}(i.clone(),t),i.blob()})}};class fe extends V{constructor(t){super(),this.isExternalMedia=!1,t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),t.playbackRate!=null&&this.onMediaEvent("canplay",()=>{t.playbackRate!=null&&(this.media.playbackRate=t.playbackRate)},{once:!0})}onMediaEvent(t,e,i){return this.media.addEventListener(t,e,i),()=>this.media.removeEventListener(t,e,i)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const t=this.getSrc();t.startsWith("blob:")&&URL.revokeObjectURL(t)}canPlayType(t){return this.media.canPlayType(t)!==""}setSrc(t,e){const i=this.getSrc();if(t&&i===t)return;this.revokeSrc();const r=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;try{this.media.src=r}catch{this.media.src=t}}destroy(){this.media.pause(),this.isExternalMedia||(this.media.remove(),this.revokeSrc(),this.media.src="",this.media.load())}setMediaElement(t){this.media=t}play(){return E(this,void 0,void 0,function*(){return this.media.play()})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=t}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){e!=null&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}}class N extends V{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[r,n]=this.initHtml();i.appendChild(r),this.container=r,this.scrollContainer=n.querySelector(".scroll"),this.wrapper=n.querySelector(".wrapper"),this.canvasWrapper=n.querySelector(".canvases"),this.progressWrapper=n.querySelector(".progress"),this.cursor=n.querySelector(".cursor"),e&&n.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){const t=e=>{const i=this.wrapper.getBoundingClientRect(),r=e.clientX-i.left,n=e.clientY-i.top;return[r/i.width,n/i.height]};if(this.wrapper.addEventListener("click",e=>{const[i,r]=t(e);this.emit("click",i,r)}),this.wrapper.addEventListener("dblclick",e=>{const[i,r]=t(e);this.emit("dblclick",i,r)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:e,scrollWidth:i,clientWidth:r}=this.scrollContainer,n=e/i,a=(e+r)/i;this.emit("scroll",n,a,e,e+r)}),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{e().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender())}initDrag(){this.subscriptions.push(function(t,e,i,r,n=3,a=0,o=100){if(!t)return()=>{};const d=matchMedia("(pointer: coarse)").matches;let c=()=>{};const l=p=>{if(p.button!==a)return;p.preventDefault(),p.stopPropagation();let h=p.clientX,m=p.clientY,f=!1;const b=Date.now(),g=C=>{if(C.preventDefault(),C.stopPropagation(),d&&Date.now()-b<o)return;const D=C.clientX,W=C.clientY,M=D-h,A=W-m;if(f||Math.abs(M)>n||Math.abs(A)>n){const I=t.getBoundingClientRect(),{left:U,top:O}=I;f||(i==null||i(h-U,m-O),f=!0),e(M,A,D-U,W-O),h=D,m=W}},w=C=>{if(f){const D=C.clientX,W=C.clientY,M=t.getBoundingClientRect(),{left:A,top:I}=M;r==null||r(D-A,W-I)}c()},y=C=>{C.relatedTarget&&C.relatedTarget!==document.documentElement||w(C)},P=C=>{f&&(C.stopPropagation(),C.preventDefault())},T=C=>{f&&C.preventDefault()};document.addEventListener("pointermove",g),document.addEventListener("pointerup",w),document.addEventListener("pointerout",y),document.addEventListener("pointercancel",y),document.addEventListener("touchmove",T,{passive:!1}),document.addEventListener("click",P,{capture:!0}),c=()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",w),document.removeEventListener("pointerout",y),document.removeEventListener("pointercancel",y),document.removeEventListener("touchmove",T),setTimeout(()=>{document.removeEventListener("click",P,{capture:!0})},10)}};return t.addEventListener("pointerdown",l),()=>{c(),t.removeEventListener("pointerdown",l)}}(this.wrapper,(t,e,i)=>{this.emit("drag",Math.max(0,Math.min(1,i/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))}))}getHeight(t,e){var i;const r=((i=this.audioData)===null||i===void 0?void 0:i.numberOfChannels)||1;if(t==null)return 128;if(!isNaN(Number(t)))return Number(t);if(t==="auto"){const n=this.parent.clientHeight||128;return e!=null&&e.every(a=>!a.overlay)?n/r:n}return 128}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"}),i=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=`
2
+ <style${i?` nonce="${i}"`:""}>
3
+ :host {
4
+ user-select: none;
5
+ min-width: 1px;
6
+ }
7
+ :host audio {
8
+ display: block;
9
+ width: 100%;
10
+ }
11
+ :host .scroll {
12
+ overflow-x: auto;
13
+ overflow-y: hidden;
14
+ width: 100%;
15
+ position: relative;
16
+ }
17
+ :host .noScrollbar {
18
+ scrollbar-color: transparent;
19
+ scrollbar-width: none;
20
+ }
21
+ :host .noScrollbar::-webkit-scrollbar {
22
+ display: none;
23
+ -webkit-appearance: none;
24
+ }
25
+ :host .wrapper {
26
+ position: relative;
27
+ overflow: visible;
28
+ z-index: 2;
29
+ }
30
+ :host .canvases {
31
+ min-height: ${this.getHeight(this.options.height,this.options.splitChannels)}px;
32
+ }
33
+ :host .canvases > div {
34
+ position: relative;
35
+ }
36
+ :host canvas {
37
+ display: block;
38
+ position: absolute;
39
+ top: 0;
40
+ image-rendering: pixelated;
41
+ }
42
+ :host .progress {
43
+ pointer-events: none;
44
+ position: absolute;
45
+ z-index: 2;
46
+ top: 0;
47
+ left: 0;
48
+ width: 0;
49
+ height: 100%;
50
+ overflow: hidden;
51
+ }
52
+ :host .progress > div {
53
+ position: relative;
54
+ }
55
+ :host .cursor {
56
+ pointer-events: none;
57
+ position: absolute;
58
+ z-index: 5;
59
+ top: 0;
60
+ left: 0;
61
+ height: 100%;
62
+ border-radius: 2px;
63
+ }
64
+ </style>
65
+
66
+ <div class="scroll" part="scroll">
67
+ <div class="wrapper" part="wrapper">
68
+ <div class="canvases" part="canvases"></div>
69
+ <div class="progress" part="progress"></div>
70
+ <div class="cursor" part="cursor"></div>
71
+ </div>
72
+ </div>
73
+ `,[t,e]}setOptions(t){if(this.options.container!==t.container){const e=this.parentFromOptionsContainer(t.container);e.appendChild(this.container),this.parent=e}t.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:e}=this.scrollContainer,i=e*t;this.setScroll(i)}destroy(){var t,e;this.subscriptions.forEach(i=>i()),this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.unsubscribeOnScroll)===null||e===void 0||e.call(this)}createDelay(t=10){let e,i;const r=()=>{e&&clearTimeout(e),i&&i()};return this.timeouts.push(r),()=>new Promise((n,a)=>{r(),i=a,e=setTimeout(()=>{e=void 0,i=void 0,n()},t)})}convertColorValues(t){if(!Array.isArray(t))return t||"";if(t.length<2)return t[0]||"";const e=document.createElement("canvas"),i=e.getContext("2d"),r=e.height*(window.devicePixelRatio||1),n=i.createLinearGradient(0,0,0,r),a=1/(t.length-1);return t.forEach((o,d)=>{const c=d*a;n.addColorStop(c,o)}),n}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(t,e,i,r){const n=t[0],a=t[1]||t[0],o=n.length,{width:d,height:c}=i.canvas,l=c/2,p=this.getPixelRatio(),h=e.barWidth?e.barWidth*p:1,m=e.barGap?e.barGap*p:e.barWidth?h/2:0,f=e.barRadius||0,b=d/(h+m)/o,g=f&&"roundRect"in i?"roundRect":"rect";i.beginPath();let w=0,y=0,P=0;for(let T=0;T<=o;T++){const C=Math.round(T*b);if(C>w){const M=Math.round(y*l*r),A=M+Math.round(P*l*r)||1;let I=l-M;e.barAlign==="top"?I=0:e.barAlign==="bottom"&&(I=c-A),i[g](w*(h+m),I,h,A,f),w=C,y=0,P=0}const D=Math.abs(n[T]||0),W=Math.abs(a[T]||0);D>y&&(y=D),W>P&&(P=W)}i.fill(),i.closePath()}renderLineWaveform(t,e,i,r){const n=a=>{const o=t[a]||t[0],d=o.length,{height:c}=i.canvas,l=c/2,p=i.canvas.width/d;i.moveTo(0,l);let h=0,m=0;for(let f=0;f<=d;f++){const b=Math.round(f*p);if(b>h){const w=l+(Math.round(m*l*r)||1)*(a===0?-1:1);i.lineTo(h,w),h=b,m=0}const g=Math.abs(o[f]||0);g>m&&(m=g)}i.lineTo(h,l)};i.beginPath(),n(0),n(1),i.fill(),i.closePath()}renderWaveform(t,e,i){if(i.fillStyle=this.convertColorValues(e.waveColor),e.renderFunction)return void e.renderFunction(t,i);let r=e.barHeight||1;if(e.normalize){const n=Array.from(t[0]).reduce((a,o)=>Math.max(a,Math.abs(o)),0);r=n?1/n:1}e.barWidth||e.barGap||e.barAlign?this.renderBarWaveform(t,e,i,r):this.renderLineWaveform(t,e,i,r)}renderSingleCanvas(t,e,i,r,n,a,o){const d=this.getPixelRatio(),c=document.createElement("canvas");c.width=Math.round(i*d),c.height=Math.round(r*d),c.style.width=`${i}px`,c.style.height=`${r}px`,c.style.left=`${Math.round(n)}px`,a.appendChild(c);const l=c.getContext("2d");if(this.renderWaveform(t,e,l),c.width>0&&c.height>0){const p=c.cloneNode(),h=p.getContext("2d");h.drawImage(c,0,0),h.globalCompositeOperation="source-in",h.fillStyle=this.convertColorValues(e.progressColor),h.fillRect(0,0,c.width,c.height),o.appendChild(p)}}renderMultiCanvas(t,e,i,r,n,a){const o=this.getPixelRatio(),{clientWidth:d}=this.scrollContainer,c=i/o;let l=Math.min(N.MAX_CANVAS_WIDTH,d,c),p={};if(e.barWidth||e.barGap){const g=e.barWidth||.5,w=g+(e.barGap||g/2);l%w!=0&&(l=Math.floor(l/w)*w)}const h=g=>{if(g<0||g>=m||p[g])return;p[g]=!0;const w=g*l,y=Math.min(c-w,l);if(y<=0)return;const P=t.map(T=>{const C=Math.floor(w/c*T.length),D=Math.floor((w+y)/c*T.length);return T.slice(C,D)});this.renderSingleCanvas(P,e,y,r,w,n,a)},m=Math.ceil(c/l);if(!this.isScrollable){for(let g=0;g<m;g++)h(g);return}const f=this.scrollContainer.scrollLeft/c,b=Math.floor(f*m);h(b-1),h(b),h(b+1),m>1&&(this.unsubscribeOnScroll=this.on("scroll",()=>{const{scrollLeft:g}=this.scrollContainer,w=Math.floor(g/c*m);Object.keys(p).length>N.MAX_NODES&&(n.innerHTML="",a.innerHTML="",p={}),h(w-1),h(w),h(w+1)}))}renderChannel(t,e,i,r){var{overlay:n}=e,a=function(l,p){var h={};for(var m in l)Object.prototype.hasOwnProperty.call(l,m)&&p.indexOf(m)<0&&(h[m]=l[m]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function"){var f=0;for(m=Object.getOwnPropertySymbols(l);f<m.length;f++)p.indexOf(m[f])<0&&Object.prototype.propertyIsEnumerable.call(l,m[f])&&(h[m[f]]=l[m[f]])}return h}(e,["overlay"]);const o=document.createElement("div"),d=this.getHeight(a.height,a.splitChannels);o.style.height=`${d}px`,n&&r>0&&(o.style.marginTop=`-${d}px`),this.canvasWrapper.style.minHeight=`${d}px`,this.canvasWrapper.appendChild(o);const c=o.cloneNode();this.progressWrapper.appendChild(c),this.renderMultiCanvas(t,a,i,d,o,c)}render(t){return E(this,void 0,void 0,function*(){var e;this.timeouts.forEach(d=>d()),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const i=this.getPixelRatio(),r=this.scrollContainer.clientWidth,n=Math.ceil(t.duration*(this.options.minPxPerSec||0));this.isScrollable=n>r;const a=this.options.fillParent&&!this.isScrollable,o=(a?r:n)*i;if(this.wrapper.style.width=a?"100%":`${n}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=t,this.emit("render"),this.options.splitChannels)for(let d=0;d<t.numberOfChannels;d++){const c=Object.assign(Object.assign({},this.options),(e=this.options.splitChannels)===null||e===void 0?void 0:e[d]);this.renderChannel([t.getChannelData(d)],c,o,d)}else{const d=[t.getChannelData(0)];t.numberOfChannels>1&&d.push(t.getChannelData(1)),this.renderChannel(d,this.options,o,0)}Promise.resolve().then(()=>this.emit("rendered"))})}reRender(){var t;if((t=this.unsubscribeOnScroll)===null||t===void 0||t.call(this),delete this.unsubscribeOnScroll,!this.audioData)return;const{scrollWidth:e}=this.scrollContainer,{right:i}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&e!==this.scrollContainer.scrollWidth){const{right:r}=this.progressWrapper.getBoundingClientRect();let n=r-i;n*=2,n=n<0?Math.floor(n):Math.ceil(n),n/=2,this.scrollContainer.scrollLeft+=n}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,e=!1){const{scrollLeft:i,scrollWidth:r,clientWidth:n}=this.scrollContainer,a=t*r,o=i,d=i+n,c=n/2;if(this.isDragging)a+30>d?this.scrollContainer.scrollLeft+=30:a-30<o&&(this.scrollContainer.scrollLeft-=30);else{(a<o||a>d)&&(this.scrollContainer.scrollLeft=a-(this.options.autoCenter?c:0));const l=a-i-c;e&&this.options.autoCenter&&l>0&&(this.scrollContainer.scrollLeft+=Math.min(l,10))}{const l=this.scrollContainer.scrollLeft,p=l/r,h=(l+n)/r;this.emit("scroll",p,h,l,l+n)}}renderProgress(t,e){if(isNaN(t))return;const i=100*t;this.canvasWrapper.style.clipPath=`polygon(${i}% 0, 100% 0, 100% 100%, ${i}% 100%)`,this.progressWrapper.style.width=`${i}%`,this.cursor.style.left=`${i}%`,this.cursor.style.transform=`translateX(-${Math.round(i)===100?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(t,e)}exportImage(t,e,i){return E(this,void 0,void 0,function*(){const r=this.canvasWrapper.querySelectorAll("canvas");if(!r.length)throw new Error("No waveform data");if(i==="dataURL"){const n=Array.from(r).map(a=>a.toDataURL(t,e));return Promise.resolve(n)}return Promise.all(Array.from(r).map(n=>new Promise((a,o)=>{n.toBlob(d=>{d?a(d):o(new Error("Could not export image"))},t,e)})))})}}N.MAX_CANVAS_WIDTH=8e3,N.MAX_NODES=10;class ge extends V{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}class gt extends V{constructor(t=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=t,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return E(this,void 0,void 0,function*(){})}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then(e=>{if(e.status>=400)throw new Error(`Failed to fetch ${t}: ${e.status} (${e.statusText})`);return e.arrayBuffer()}).then(e=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(e)).then(e=>{this.currentSrc===t&&(this.buffer=e,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})}_play(){var t;if(!this.paused)return;this.paused=!1,(t=this.bufferNode)===null||t===void 0||t.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let e=this.playedDuration*this._playbackRate;e>=this.duration&&(e=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,e),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var t;this.paused=!0,(t=this.bufferNode)===null||t===void 0||t.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return E(this,void 0,void 0,function*(){this.paused&&(this._play(),this.emit("play"))})}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){var e,i;const r=t-this.currentTime;(e=this.bufferNode)===null||e===void 0||e.stop(this.audioContext.currentTime+r),(i=this.bufferNode)===null||i===void 0||i.addEventListener("ended",()=>{this.bufferNode=null,this.pause()},{once:!0})}setSinkId(t){return E(this,void 0,void 0,function*(){return this.audioContext.setSinkId(t)})}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(t){const e=!this.paused;e&&this._pause(),this.playedDuration=t/this._playbackRate,e&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,e;return(t=this._duration)!==null&&t!==void 0?t:((e=this.buffer)===null||e===void 0?void 0:e.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){const t=[];if(!this.buffer)return t;const e=this.buffer.numberOfChannels;for(let i=0;i<e;i++)t.push(this.buffer.getChannelData(i));return t}}const ve={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class F extends fe{static create(t){return new F(t)}constructor(t){const e=t.media||(t.backend==="WebAudio"?new gt:void 0);super({media:e,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},ve,t),this.timer=new ge;const i=e?void 0:this.getMediaElement();this.renderer=new N(this.options,i),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const r=this.options.url||this.getSrc()||"";Promise.resolve().then(()=>{this.emit("init");const{peaks:n,duration:a}=this.options;(r||n&&a)&&this.load(r,n,a).catch(()=>null)})}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t)}}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",()=>{const t=this.updateProgress();this.emit("timeupdate",t)}),this.onMediaEvent("play",()=>{this.emit("play"),this.timer.start()}),this.onMediaEvent("pause",()=>{this.emit("pause"),this.timer.stop()}),this.onMediaEvent("emptied",()=>{this.timer.stop()}),this.onMediaEvent("ended",()=>{this.emit("finish")}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}),this.onMediaEvent("error",t=>{this.emit("error",t.error)}))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",(t,e)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,e))}),this.renderer.on("dblclick",(t,e)=>{this.emit("dblclick",t,e)}),this.renderer.on("scroll",(t,e,i,r)=>{const n=this.getDuration();this.emit("scroll",t*n,e*n,i,r)}),this.renderer.on("render",()=>{this.emit("redraw")}),this.renderer.on("rendered",()=>{this.emit("redrawcomplete")}),this.renderer.on("dragstart",t=>{this.emit("dragstart",t)}),this.renderer.on("dragend",t=>{this.emit("dragend",t)}));{let t;this.subscriptions.push(this.renderer.on("drag",e=>{if(!this.options.interact)return;let i;this.renderer.renderProgress(e),clearTimeout(t),this.isPlaying()?i=0:this.options.dragToSeek===!0?i=200:typeof this.options.dragToSeek=="object"&&this.options.dragToSeek!==void 0&&(i=this.options.dragToSeek.debounceTime),t=setTimeout(()=>{this.seekTo(e)},i),this.emit("interaction",e*this.getDuration()),this.emit("drag",e)}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach(e=>{this.registerPlugin(e)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(t=>t()),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){return t._init(this),this.plugins.push(t),this.subscriptions.push(t.once("destroy",()=>{this.plugins=this.plugins.filter(e=>e!==t)})),t}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const e=t/this.getDuration();this.renderer.setScrollPercentage(e)}getActivePlugins(){return this.plugins}loadAudio(t,e,i,r){return E(this,void 0,void 0,function*(){var n;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,!e&&!i){const o=this.options.fetchParams||{};window.AbortController&&!o.signal&&(this.abortController=new AbortController,o.signal=(n=this.abortController)===null||n===void 0?void 0:n.signal);const d=c=>this.emit("loading",c);e=yield me.fetchBlob(t,d,o)}this.setSrc(t,e);const a=yield new Promise(o=>{const d=r||this.getDuration();d?o(d):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",()=>o(this.getDuration()),{once:!0}))});if(!t&&!e){const o=this.getMediaElement();o instanceof gt&&(o.duration=a)}if(i)this.decodedData=mt.createBuffer(i,a||0);else if(e){const o=yield e.arrayBuffer();this.decodedData=yield mt.decode(o,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())})}load(t,e,i){return E(this,void 0,void 0,function*(){try{return yield this.loadAudio(t,void 0,e,i)}catch(r){throw this.emit("error",r),r}})}loadBlob(t,e,i){return E(this,void 0,void 0,function*(){try{return yield this.loadAudio("",t,e,i)}catch(r){throw this.emit("error",r),r}})}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:e=8e3,precision:i=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const r=Math.min(t,this.decodedData.numberOfChannels),n=[];for(let a=0;a<r;a++){const o=this.decodedData.getChannelData(a),d=[],c=o.length/e;for(let l=0;l<e;l++){const p=o.slice(Math.floor(l*c),Math.ceil((l+1)*c));let h=0;for(let m=0;m<p.length;m++){const f=p[m];Math.abs(f)>Math.abs(h)&&(h=f)}d.push(Math.round(h*i)/i)}n.push(d)}return n}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const e=this.getDuration()*t;this.setTime(e)}playPause(){return E(this,void 0,void 0,function*(){return this.isPlaying()?this.pause():this.play()})}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return E(this,arguments,void 0,function*(t="image/png",e=1,i="dataURL"){return this.renderer.exportImage(t,e,i)})}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach(e=>e.destroy()),this.subscriptions.forEach(e=>e()),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}F.BasePlugin=class extends V{constructor(s){super(),this.subscriptions=[],this.options=s}onInit(){}_init(s){this.wavesurfer=s,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(s=>s())}},F.dom=pe;function tt(s,t,e,i){return new(e||(e=Promise))(function(r,n){function a(c){try{d(i.next(c))}catch(l){n(l)}}function o(c){try{d(i.throw(c))}catch(l){n(l)}}function d(c){var l;c.done?r(c.value):(l=c.value,l instanceof e?l:new e(function(p){p(l)})).then(a,o)}d((i=i.apply(s,[])).next())})}class Pt{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),i==null?void 0:i.once){const r=()=>{this.un(t,r),this.un(t,e)};return this.on(t,r),r}return()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}}class be extends Pt{constructor(t){super(),this.subscriptions=[],this.options=t}onInit(){}_init(t){this.wavesurfer=t,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(t=>t())}}class ye extends Pt{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}const we=["audio/webm","audio/wav","audio/mpeg","audio/mp4","audio/mp3"];class q extends be{constructor(t){var e,i,r,n,a,o;super(Object.assign(Object.assign({},t),{audioBitsPerSecond:(e=t.audioBitsPerSecond)!==null&&e!==void 0?e:128e3,scrollingWaveform:(i=t.scrollingWaveform)!==null&&i!==void 0&&i,scrollingWaveformWindow:(r=t.scrollingWaveformWindow)!==null&&r!==void 0?r:5,continuousWaveform:(n=t.continuousWaveform)!==null&&n!==void 0&&n,renderRecordedAudio:(a=t.renderRecordedAudio)===null||a===void 0||a,mediaRecorderTimeslice:(o=t.mediaRecorderTimeslice)!==null&&o!==void 0?o:void 0})),this.stream=null,this.mediaRecorder=null,this.dataWindow=null,this.isWaveformPaused=!1,this.lastStartTime=0,this.lastDuration=0,this.duration=0,this.timer=new ye,this.subscriptions.push(this.timer.on("tick",()=>{const d=performance.now()-this.lastStartTime;this.duration=this.isPaused()?this.duration:this.lastDuration+d,this.emit("record-progress",this.duration)}))}static create(t){return new q(t||{})}renderMicStream(t){var e;const i=new AudioContext,r=i.createMediaStreamSource(t),n=i.createAnalyser();r.connect(n),this.options.continuousWaveform&&(n.fftSize=32);const a=n.frequencyBinCount,o=new Float32Array(a);let d=0;this.wavesurfer&&((e=this.originalOptions)!==null&&e!==void 0||(this.originalOptions=Object.assign({},this.wavesurfer.options)),this.wavesurfer.options.interact=!1,this.options.scrollingWaveform&&(this.wavesurfer.options.cursorWidth=0));const c=setInterval(()=>{var l,p,h,m;if(!this.isWaveformPaused){if(n.getFloatTimeDomainData(o),this.options.scrollingWaveform){const f=Math.floor((this.options.scrollingWaveformWindow||0)*i.sampleRate),b=Math.min(f,this.dataWindow?this.dataWindow.length+a:a),g=new Float32Array(f);if(this.dataWindow){const w=Math.max(0,f-this.dataWindow.length);g.set(this.dataWindow.slice(-b+a),w)}g.set(o,f-a),this.dataWindow=g}else if(this.options.continuousWaveform){if(!this.dataWindow){const b=this.options.continuousWaveformDuration?Math.round(100*this.options.continuousWaveformDuration):((p=(l=this.wavesurfer)===null||l===void 0?void 0:l.getWidth())!==null&&p!==void 0?p:0)*window.devicePixelRatio;this.dataWindow=new Float32Array(b)}let f=0;for(let b=0;b<a;b++){const g=Math.abs(o[b]);g>f&&(f=g)}if(d+1>this.dataWindow.length){const b=new Float32Array(2*this.dataWindow.length);b.set(this.dataWindow,0),this.dataWindow=b}this.dataWindow[d]=f,d++}else this.dataWindow=o;if(this.wavesurfer){const f=((m=(h=this.dataWindow)===null||h===void 0?void 0:h.length)!==null&&m!==void 0?m:0)/100;this.wavesurfer.load("",[this.dataWindow],this.options.scrollingWaveform?this.options.scrollingWaveformWindow:f).then(()=>{this.wavesurfer&&this.options.continuousWaveform&&(this.wavesurfer.setTime(this.getDuration()/1e3),this.wavesurfer.options.minPxPerSec||this.wavesurfer.setOptions({minPxPerSec:this.wavesurfer.getWidth()/this.wavesurfer.getDuration()}))}).catch(b=>{console.error("Error rendering real-time recording data:",b)})}}},10);return{onDestroy:()=>{clearInterval(c),r==null||r.disconnect(),i==null||i.close()},onEnd:()=>{this.isWaveformPaused=!0,clearInterval(c),this.stopMic()}}}startMic(t){return tt(this,void 0,void 0,function*(){let e;try{e=yield navigator.mediaDevices.getUserMedia({audio:!(t!=null&&t.deviceId)||{deviceId:t.deviceId}})}catch(n){throw new Error("Error accessing the microphone: "+n.message)}const{onDestroy:i,onEnd:r}=this.renderMicStream(e);return this.subscriptions.push(this.once("destroy",i)),this.subscriptions.push(this.once("record-end",r)),this.stream=e,e})}stopMic(){this.stream&&(this.stream.getTracks().forEach(t=>t.stop()),this.stream=null,this.mediaRecorder=null)}startRecording(t){return tt(this,void 0,void 0,function*(){const e=this.stream||(yield this.startMic(t));this.dataWindow=null;const i=this.mediaRecorder||new MediaRecorder(e,{mimeType:this.options.mimeType||we.find(a=>MediaRecorder.isTypeSupported(a)),audioBitsPerSecond:this.options.audioBitsPerSecond});this.mediaRecorder=i,this.stopRecording();const r=[];i.ondataavailable=a=>{a.data.size>0&&r.push(a.data),this.emit("record-data-available",a.data)};const n=a=>{var o;const d=new Blob(r,{type:i.mimeType});this.emit(a,d),this.options.renderRecordedAudio&&(this.applyOriginalOptionsIfNeeded(),(o=this.wavesurfer)===null||o===void 0||o.load(URL.createObjectURL(d)))};i.onpause=()=>n("record-pause"),i.onstop=()=>n("record-end"),i.start(this.options.mediaRecorderTimeslice),this.lastStartTime=performance.now(),this.lastDuration=0,this.duration=0,this.isWaveformPaused=!1,this.timer.start(),this.emit("record-start")})}getDuration(){return this.duration}isRecording(){var t;return((t=this.mediaRecorder)===null||t===void 0?void 0:t.state)==="recording"}isPaused(){var t;return((t=this.mediaRecorder)===null||t===void 0?void 0:t.state)==="paused"}isActive(){var t;return((t=this.mediaRecorder)===null||t===void 0?void 0:t.state)!=="inactive"}stopRecording(){var t;this.isActive()&&((t=this.mediaRecorder)===null||t===void 0||t.stop(),this.timer.stop())}pauseRecording(){var t,e;this.isRecording()&&(this.isWaveformPaused=!0,(t=this.mediaRecorder)===null||t===void 0||t.requestData(),(e=this.mediaRecorder)===null||e===void 0||e.pause(),this.timer.stop(),this.lastDuration=this.duration)}resumeRecording(){var t;this.isPaused()&&(this.isWaveformPaused=!1,(t=this.mediaRecorder)===null||t===void 0||t.resume(),this.timer.start(),this.lastStartTime=performance.now(),this.emit("record-resume"))}static getAvailableAudioDevices(){return tt(this,void 0,void 0,function*(){return navigator.mediaDevices.enumerateDevices().then(t=>t.filter(e=>e.kind==="audioinput"))})}destroy(){this.applyOriginalOptionsIfNeeded(),super.destroy(),this.stopRecording(),this.stopMic()}applyOriginalOptionsIfNeeded(){this.wavesurfer&&this.originalOptions&&(this.wavesurfer.setOptions(this.originalOptions),delete this.originalOptions)}}const Ce=async({files:s,uploadClient:t,widgetMgr:e,widgetInfo:i,fragmentId:r})=>{let n=[];try{n=await t.fetchFileURLs(s)}catch(c){return{successfulUploads:[],failedUploads:s.map(l=>({file:l,error:ut(c)}))}}const a=Ht(s,n),o=[],d=[];return await Promise.all(a.map(async([c,l])=>{if(!c||!l||!l.uploadUrl||!l.fileId)return{file:c,fileUrl:l,error:new Error("No upload URL found")};try{await t.uploadFile({id:l.fileId,formId:i.formId||""},l.uploadUrl,c),o.push({fileUrl:l,file:c})}catch(p){const h=ut(p);d.push({file:c,error:h})}})),e.setFileUploaderStateValue(i,new Vt({uploadedFileInfo:o.map(({file:c,fileUrl:l})=>new jt({fileId:l.fileId,fileUrls:l,name:c.name,size:c.size}))}),{fromUi:!0},r),{successfulUploads:o,failedUploads:d}},et=({widgetMgr:s,id:t,formId:e,key:i,defaultValue:r})=>{u.useEffect(()=>{const l=s.getElementState(t,i);G(l)&&X(r)&&s.setElementState(t,i,r)},[s,t,i,r]);const[n,a]=u.useState(s.getElementState(t,i)??r),o=u.useCallback(l=>{s.setElementState(t,i,l),a(l)},[s,t,i]),d=u.useMemo(()=>({formId:e||""}),[e]),c=u.useCallback(()=>o(r),[r,o]);return oe({element:d,widgetMgr:s,onFormCleared:c}),[n,o]},Se=(s,t)=>{const{libConfig:{enforceDownloadInNewTab:e=!1}}=yt.useContext(Gt);return u.useCallback(()=>{if(!s)return;const r=de({enforceDownloadInNewTab:e,url:s,filename:t});r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r)},[s,e,t])},Re=x("div",{target:"etzg8g80"})(),vt=x("div",{target:"etzg8g81"})(({theme:s})=>({height:s.sizes.largestElementHeight,width:"100%",background:s.colors.secondaryBg,borderRadius:s.radii.default,marginBottom:s.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:s.spacing.xs,paddingRight:s.spacing.sm,border:s.colors.widgetBorderColor?`${s.sizes.borderWidth} solid ${s.colors.widgetBorderColor}`:void 0})),Ee=x("div",{target:"etzg8g82"})({flex:1}),xe=x("div",{target:"etzg8g83"})(({show:s})=>({display:s?"block":"none"})),Pe=x("span",{target:"etzg8g84"})(({theme:s,isPlayingOrRecording:t})=>({margin:s.spacing.sm,fontFamily:s.fonts.monospace,color:t?s.colors.bodyText:s.colors.fadedText60,backgroundColor:s.colors.secondaryBg,fontSize:s.fontSizes.sm})),Tt=x("div",{target:"etzg8g85"})({width:"100%",textAlign:"center",overflow:"hidden"}),Dt=x("span",{target:"etzg8g86"})(({theme:s})=>({color:s.colors.bodyText})),Te=x("a",{target:"etzg8g87"})(({theme:s})=>({color:s.colors.link,textDecoration:"underline"})),De=x("div",{target:"etzg8g88"})(({theme:s})=>({height:s.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"})),We=x("div",{target:"etzg8g89"})(({theme:s})=>{const t="0.625em";return{opacity:.2,width:"100%",height:t,backgroundSize:t,backgroundImage:`radial-gradient(${s.colors.fadedText10} 40%, transparent 40%)`,backgroundRepeat:"repeat"}}),Ae=x("span",{target:"etzg8g810"})(({theme:s})=>({"& > button":{color:s.colors.primary,padding:s.spacing.threeXS},"& > button:hover, & > button:focus":{color:s.colors.red}})),ke=x("span",{target:"etzg8g811"})(({theme:s})=>({"& > button":{padding:s.spacing.threeXS,color:s.colors.fadedText40},"& > button:hover, & > button:focus":{color:s.colors.primary}})),Wt=x("span",{target:"etzg8g812"})(({theme:s})=>({"& > button":{padding:s.spacing.threeXS,color:s.colors.fadedText60},"& > button:hover, & > button:focus":{color:s.colors.bodyText}})),it=x("div",{target:"etzg8g813"})(({theme:s})=>({display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:s.spacing.xs,gap:s.spacing.twoXS,marginRight:s.spacing.twoXS})),Me=x("div",{target:"etzg8g814"})(({theme:s})=>({marginLeft:s.spacing.sm})),Ie=x(Xt,{target:"etzg8g815"})(({theme:s})=>({fontSize:s.fontSizes.sm,width:s.sizes.spinnerSize,height:s.sizes.spinnerSize,borderWidth:s.sizes.spinnerThickness,justifyContents:"center",padding:s.spacing.none,margin:s.spacing.none,borderColor:s.colors.borderColor,borderTopColor:s.colors.secondary,flexGrow:0,flexShrink:0})),Le=()=>z(Tt,{children:[v(Dt,{children:"This app would like to use your microphone."})," ",v(Te,{href:qt,children:"Learn how to allow access."})]}),Oe=()=>v(De,{children:v(We,{})}),Be=4,ze=4,Ne=4,Ue=8,Fe=0,j="00:00",bt=s=>new Date(s).toLocaleTimeString(void 0,{minute:"2-digit",second:"2-digit",timeZone:"UTC"}),_=({onClick:s,disabled:t,ariaLabel:e,iconContent:i})=>v(Kt,{kind:Yt.BORDERLESS_ICON,onClick:s,disabled:t,"aria-label":e,fluidWidth:!0,"data-testid":"stAudioInputActionButton",children:v(Jt,{content:i,size:"lg",color:"inherit"})}),_e=({disabled:s,stopRecording:t})=>v(Ae,{children:v(_,{onClick:t,disabled:s,ariaLabel:"Stop recording",iconContent:Et})}),$e=({disabled:s,isPlaying:t,onClickPlayPause:e})=>v(Wt,{children:t?v(_,{onClick:e,disabled:s,ariaLabel:"Pause",iconContent:Ct}):v(_,{onClick:e,disabled:s,ariaLabel:"Play",iconContent:St})}),He=({disabled:s,startRecording:t})=>v(ke,{children:v(_,{onClick:t,disabled:s,ariaLabel:"Record",iconContent:wt})}),Ve=({onClick:s})=>v(Wt,{children:v(_,{disabled:!1,onClick:s,ariaLabel:"Reset",iconContent:Rt})}),je=({disabled:s,isRecording:t,isPlaying:e,isUploading:i,isError:r,recordingUrlExists:n,startRecording:a,stopRecording:o,onClickPlayPause:d,onClear:c})=>r?v(it,{children:v(Ve,{onClick:c})}):i?v(it,{children:v(Ie,{"aria-label":"Uploading"})}):z(it,{children:[t?v(_e,{disabled:s,stopRecording:o}):v(He,{disabled:s,startRecording:a}),n&&v($e,{disabled:s,isPlaying:e,onClickPlayPause:d})]}),Ge=u.memo(je),Xe=Zt.getLogger("convertAudioToWav");async function qe(s){const t=new window.AudioContext,e=await s.arrayBuffer();let i;try{i=await t.decodeAudioData(e)}catch(m){Xe.error(m);return}const r=44,n=i.numberOfChannels,a=i.sampleRate,o=i.length*n*2+r,d=new ArrayBuffer(o),c=new DataView(d),l={0:{type:"string",value:"RIFF"},4:{type:"uint32",value:o-8},8:{type:"string",value:"WAVE"},12:{type:"string",value:"fmt "},16:{type:"uint32",value:16},20:{type:"uint16",value:1},22:{type:"uint16",value:n},24:{type:"uint32",value:a},28:{type:"uint32",value:a*n*2},32:{type:"uint16",value:n*2},34:{type:"uint16",value:16},36:{type:"string",value:"data"},40:{type:"uint32",value:i.length*n*2}};Object.entries(l).forEach(([m,{type:f,value:b}])=>{const g=parseInt(m,10);f==="string"?Ye(c,g,b):f==="uint32"?c.setUint32(g,b,!0):f==="uint16"&&c.setUint16(g,b,!0)});let p=r;for(let m=0;m<i.length;m++)for(let f=0;f<n;f++){const b=Math.max(-1,Math.min(1,i.getChannelData(f)[m]));c.setInt16(p,b*32767,!0),p+=2}const h=new Uint8Array(d);return new Blob([h],{type:"audio/wav"})}function Ye(s,t,e){for(let i=0;i<e.length;i++)s.setUint8(t+i,e.charCodeAt(i))}const Je=()=>v(Tt,{children:v(Dt,{children:"An error has occurred, please try again."})}),Ke=({element:s,uploadClient:t,widgetMgr:e,fragmentId:i,disabled:r})=>{var ht;const n=Qt(),a=ce(n),[o,d]=u.useState(null),c=yt.useRef(null),[l,p]=et({widgetMgr:e,id:s.id,key:"deleteFileUrl",defaultValue:null}),[h,m]=u.useState(null),[f,b]=u.useState([]),[g,w]=u.useState(null),[y,P]=et({widgetMgr:e,id:s.id,key:"recordingUrl",defaultValue:null}),[,T]=u.useState(0),C=()=>{T(S=>S+1)},[D,W]=u.useState(j),[M,A]=et({widgetMgr:e,id:s.id,formId:s.formId,key:"recordingTime",defaultValue:j}),[I,U]=u.useState(!1),[O,At]=u.useState(!1),[st,kt]=u.useState(!1),[Mt,nt]=u.useState(!1),[Y,J]=u.useState(!1),rt=s.id,L=s.formId,ot=u.useCallback(async S=>{nt(!0),X(L)&&e.setFormsWithUploadsInProgress(new Set([L]));let R;if(S.type==="audio/wav"?R=S:R=await qe(S),!R){J(!0);return}const k=URL.createObjectURL(R),Ut=new Date().toISOString().slice(0,16).replace(":","-"),Ft=new File([R],`${Ut}_audio.wav`,{type:R.type});P(k),Ce({files:[Ft],uploadClient:t,widgetMgr:e,widgetInfo:{id:rt,formId:L},fragmentId:i}).then(({successfulUploads:_t,failedUploads:$t})=>{if($t.length>0){J(!0);return}const Z=_t[0];Z&&Z.fileUrl.deleteUrl&&p(Z.fileUrl.deleteUrl)}).finally(()=>{X(L)&&e.setFormsWithUploadsInProgress(new Set),nt(!1)})},[P,t,e,rt,L,i,p]),B=u.useCallback(({updateWidgetManager:S,deleteFile:R})=>{G(o)||G(l)||(P(null),o.empty(),R&&t.deleteFile(l),p(null),W(j),A(j),S&&e.setFileUploaderStateValue(s,{},{fromUi:!0},i),U(!1),X(y)&&URL.revokeObjectURL(y))},[l,y,t,o,s,e,i,A,P,p]);u.useEffect(()=>{if(G(L))return;const S=new ae;return S.manageFormClearListener(e,L,()=>B({updateWidgetManager:!0,deleteFile:!1})),()=>S.disconnect()},[L,B,e]);const at=u.useCallback(()=>{if(c.current===null)return;const S=F.create({container:c.current,waveColor:y?Q(n.colors.fadedText40,n.colors.secondaryBg):n.colors.primary,progressColor:n.colors.bodyText,height:te(n.sizes.largestElementHeight)-2*Be,barWidth:ze,barGap:Ne,barRadius:Ue,cursorWidth:Fe,url:y??void 0});S.on("timeupdate",k=>{W(bt(k*1e3))}),S.on("pause",()=>{C()});const R=S.registerPlugin(q.create({scrollingWaveform:!1,renderRecordedAudio:!0}));return R.on("record-end",async k=>{ot(k)}),R.on("record-progress",k=>{A(bt(k))}),d(S),m(R),()=>{S&&S.destroy(),R&&R.destroy()}},[ot]);u.useEffect(()=>at(),[at]),u.useEffect(()=>{ee(a,n)||o==null||o.setOptions({waveColor:y?Q(n.colors.fadedText40,n.colors.secondaryBg):n.colors.primary,progressColor:n.colors.bodyText})},[n,a,y,o]);const It=u.useCallback(()=>{o&&(o.playPause(),U(!0),C())},[o]),Lt=u.useCallback(async()=>{let S=g;st||(await navigator.mediaDevices.getUserMedia({audio:!0}).then(()=>q.getAvailableAudioDevices().then(R=>{if(b(R),R.length>0){const{deviceId:k}=R[0];w(k),S=k}})).catch(R=>{At(!0)}),kt(!0)),!(!h||!S||!o)&&(o.setOptions({waveColor:n.colors.primary}),y&&B({updateWidgetManager:!1,deleteFile:!0}),h.startRecording({deviceId:S}).then(()=>{C()}))},[g,h,n,o,y,B,st]),Ot=u.useCallback(()=>{h&&(h.stopRecording(),o==null||o.setOptions({waveColor:Q(n.colors.fadedText40,n.colors.secondaryBg)}))},[h,o,n]),Bt=Se(y,"recording.wav"),K=!!(h!=null&&h.isRecording()),lt=!!(o!=null&&o.isPlaying()),zt=K||lt,ct=!K&&!y&&!O,Nt=O||ct||Y,dt=r||O;return z(Re,{className:"stAudioInput","data-testid":"stAudioInput",children:[v(re,{label:s.label,disabled:dt,labelVisibility:ie((ht=s.labelVisibility)==null?void 0:ht.value),children:s.help&&v(Me,{children:v(se,{content:s.help,placement:ne.TOP})})}),z(vt,{children:[z(le,{isFullScreen:!1,disableFullscreenMode:!0,target:vt,children:[y&&v(pt,{label:"Download as WAV",icon:he,onClick:()=>Bt()}),l&&v(pt,{label:"Clear recording",icon:ue,onClick:()=>B({updateWidgetManager:!0,deleteFile:!0})})]}),v(Ge,{isRecording:K,isPlaying:lt,isUploading:Mt,isError:Y,recordingUrlExists:!!y,startRecording:Lt,stopRecording:Ot,onClickPlayPause:It,onClear:()=>{B({updateWidgetManager:!1,deleteFile:!0}),J(!1)},disabled:dt}),z(Ee,{children:[Y&&v(Je,{}),ct&&v(Oe,{}),O&&v(Le,{}),v(xe,{"data-testid":"stAudioInputWaveSurfer",ref:c,show:!Nt})]}),v(Pe,{isPlayingOrRecording:zt,"data-testid":"stAudioInputWaveformTimeCode",children:I?D:M})]})]})},ri=u.memo(Ke);export{ri as default};
@@ -1 +1 @@
1
- import{n as s,R as g,aF as b,bc as k,y as C,j as n,ba as v,bd as L,z as y,D as w,aE as S}from"./index.B7J6suR-.js";const T=s("div",{target:"e1xmaixs0"})({display:"flex",flexDirection:"column"}),h=s("a",{target:"e1xmaixs1"})(({disabled:a,isCurrentPage:o,fluidWidth:t,theme:e})=>({textDecoration:"none",width:typeof t=="number"?`${t}px`:"fit-content",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:e.spacing.sm,borderRadius:e.radii.default,paddingLeft:e.spacing.sm,paddingRight:e.spacing.sm,marginTop:e.spacing.threeXS,marginBottom:e.spacing.threeXS,lineHeight:e.lineHeights.menuItem,backgroundColor:o?e.colors.darkenedBgMix15:"transparent","&:hover":{backgroundColor:o?e.colors.darkenedBgMix25:e.colors.darkenedBgMix15},"&:active,&:visited,&:hover":{textDecoration:"none"},"&:focus":{outline:"none"},"&:focus-visible":{backgroundColor:e.colors.darkenedBgMix15},"@media print":{paddingLeft:e.spacing.none},...a?{borderColor:e.colors.borderColor,backgroundColor:e.colors.transparent,color:e.colors.fadedText40,cursor:"not-allowed","&:hover":{color:e.colors.fadedText40,backgroundColor:e.colors.transparent}}:{}})),D=s("span",{target:"e1xmaixs2"})(({disabled:a,theme:o})=>({color:o.colors.bodyText,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",display:"table-cell",...a?{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}:{}}));function P(a,o){return a===null&&o?!0:a===null&&!o?!1:a===!0}function H(a){const{onPageChange:o,currentPageScriptHash:t}=g.useContext(b),e=g.useContext(k),{colors:u}=C(),{disabled:l,element:r,width:i}=a,p={width:i},f=P(r.useContainerWidth,e),c=t===r.pageScriptHash,x=d=>{r.external?l&&d.preventDefault():(d.preventDefault(),l||o(r.pageScriptHash))};return n("div",{className:"stPageLink","data-testid":"stPageLink",style:p,children:n(v,{help:r.help,placement:L.TOP_RIGHT,children:n(T,{children:y(h,{"data-testid":"stPageLink-NavLink",disabled:l,isCurrentPage:c,fluidWidth:f?i:!1,href:r.page,target:r.external?"_blank":"",rel:"noreferrer",onClick:x,children:[r.icon&&n(w,{size:"lg",color:u.bodyText,iconValue:r.icon}),n(D,{disabled:l,children:n(S,{source:r.label,allowHTML:!1,isLabel:!0,boldLabel:c,largerLabel:!0,disableLinks:!0})})]})})})})}export{H as default};
1
+ import{n as s,R as u,aF as b,bb as k,y as C,j as n,b9 as v,bc as L,z as y,D as T,aE as w}from"./index.DuqdUleB.js";const S=s("div",{target:"e1xmaixs0"})({display:"flex",flexDirection:"column"}),h=s("a",{target:"e1xmaixs1"})(({disabled:a,isCurrentPage:o,fluidWidth:l,theme:e})=>({textDecoration:"none",width:typeof l=="number"?`${l}px`:"fit-content",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:e.spacing.sm,borderRadius:e.radii.default,paddingLeft:e.spacing.sm,paddingRight:e.spacing.sm,marginTop:e.spacing.threeXS,marginBottom:e.spacing.threeXS,lineHeight:e.lineHeights.menuItem,backgroundColor:o?e.colors.darkenedBgMix15:"transparent","&:hover":{backgroundColor:o?e.colors.darkenedBgMix25:e.colors.darkenedBgMix15},"&:active,&:visited,&:hover":{textDecoration:"none"},"&:focus":{outline:"none"},"&:focus-visible":{backgroundColor:e.colors.darkenedBgMix15},"@media print":{paddingLeft:e.spacing.none},...a?{borderColor:e.colors.borderColor,backgroundColor:e.colors.transparent,color:e.colors.fadedText40,cursor:"not-allowed","&:hover":{color:e.colors.fadedText40,backgroundColor:e.colors.transparent}}:{}})),D=s("span",{target:"e1xmaixs2"})(({disabled:a,theme:o})=>({color:o.colors.bodyText,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",display:"table-cell",...a?{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}:{}}));function P(a,o){return a===null&&o?!0:a===null&&!o?!1:a===!0}function H(a){const{onPageChange:o,currentPageScriptHash:l}=u.useContext(b),e=u.useContext(k),{colors:i}=C(),{disabled:t,element:r,width:c}=a,p={width:c},f=P(r.useContainerWidth,e),d=l===r.pageScriptHash,x=g=>{r.external?t&&g.preventDefault():(g.preventDefault(),t||o(r.pageScriptHash))};return n("div",{className:"stPageLink","data-testid":"stPageLink",style:p,children:n(v,{help:r.help,placement:L.TOP_RIGHT,children:n(S,{children:y(h,{"data-testid":"stPageLink-NavLink",disabled:t,isCurrentPage:d,fluidWidth:f?c:!1,href:r.page,target:r.external?"_blank":"",rel:"noreferrer",onClick:x,children:[r.icon&&n(T,{size:"lg",color:t?i.fadedText40:i.bodyText,iconValue:r.icon}),n(D,{disabled:t,children:n(w,{source:r.label,allowHTML:!1,isLabel:!0,boldLabel:d,largerLabel:!0,disableLinks:!0})})]})})})})}export{H as default};