streamlit-nightly 1.53.2.dev20260131__py3-none-any.whl → 1.53.2.dev20260203__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 (205) hide show
  1. streamlit/commands/execution_control.py +2 -2
  2. streamlit/commands/logo.py +6 -10
  3. streamlit/components/v2/component_path_utils.py +17 -29
  4. streamlit/config.py +4 -2
  5. streamlit/delta_generator.py +2 -0
  6. streamlit/elements/lib/column_types.py +6 -2
  7. streamlit/elements/lib/utils.py +6 -6
  8. streamlit/elements/markdown.py +0 -1
  9. streamlit/elements/metric.py +2 -1
  10. streamlit/elements/widgets/button_group.py +6 -276
  11. streamlit/elements/widgets/feedback.py +322 -0
  12. streamlit/elements/widgets/number_input.py +2 -1
  13. streamlit/elements/widgets/slider.py +2 -1
  14. streamlit/material_icon_names.py +1 -1
  15. streamlit/path_security.py +98 -0
  16. streamlit/proto/AudioInput_pb2.py +4 -4
  17. streamlit/proto/AudioInput_pb2.pyi +3 -3
  18. streamlit/proto/Audio_pb2.py +2 -2
  19. streamlit/proto/BackMsg_pb2.pyi +2 -10
  20. streamlit/proto/Balloons_pb2.pyi +0 -2
  21. streamlit/proto/Block_pb2.py +35 -35
  22. streamlit/proto/ButtonGroup_pb2.py +10 -12
  23. streamlit/proto/ButtonGroup_pb2.pyi +6 -41
  24. streamlit/proto/Button_pb2.py +2 -2
  25. streamlit/proto/CameraInput_pb2.py +4 -4
  26. streamlit/proto/CameraInput_pb2.pyi +3 -3
  27. streamlit/proto/ChatInput_pb2.py +2 -2
  28. streamlit/proto/Checkbox_pb2.py +6 -6
  29. streamlit/proto/Checkbox_pb2.pyi +3 -3
  30. streamlit/proto/Code_pb2.py +2 -2
  31. streamlit/proto/ColorPicker_pb2.py +4 -4
  32. streamlit/proto/ColorPicker_pb2.pyi +3 -3
  33. streamlit/proto/Common_pb2.py +6 -6
  34. streamlit/proto/DateInput_pb2.py +4 -4
  35. streamlit/proto/DateInput_pb2.pyi +3 -3
  36. streamlit/proto/DateTimeInput_pb2.py +4 -4
  37. streamlit/proto/DateTimeInput_pb2.pyi +3 -3
  38. streamlit/proto/DeckGlJsonChart_pb2.py +2 -2
  39. streamlit/proto/Delta_pb2.py +2 -2
  40. streamlit/proto/DocString_pb2.py +1 -1
  41. streamlit/proto/Element_pb2.py +4 -4
  42. streamlit/proto/Element_pb2.pyi +9 -9
  43. streamlit/proto/Feedback_pb2.py +28 -0
  44. streamlit/proto/Feedback_pb2.pyi +93 -0
  45. streamlit/proto/FileUploader_pb2.py +4 -4
  46. streamlit/proto/FileUploader_pb2.pyi +3 -3
  47. streamlit/proto/ForwardMsg_pb2.py +8 -8
  48. streamlit/proto/GraphVizChart_pb2.py +2 -2
  49. streamlit/proto/IFrame_pb2.py +3 -3
  50. streamlit/proto/Image_pb2.py +4 -4
  51. streamlit/proto/Image_pb2.pyi +1 -7
  52. streamlit/proto/{BokehChart_pb2.py → LabelVisibility_pb2.py} +7 -5
  53. streamlit/proto/{LabelVisibilityMessage_pb2.pyi → LabelVisibility_pb2.pyi} +14 -14
  54. streamlit/proto/Markdown_pb2.py +4 -4
  55. streamlit/proto/Markdown_pb2.pyi +1 -5
  56. streamlit/proto/Metric_pb2.py +10 -10
  57. streamlit/proto/Metric_pb2.pyi +3 -3
  58. streamlit/proto/MultiSelect_pb2.py +4 -4
  59. streamlit/proto/MultiSelect_pb2.pyi +3 -3
  60. streamlit/proto/NewSession_pb2.py +38 -26
  61. streamlit/proto/NewSession_pb2.pyi +42 -8
  62. streamlit/proto/NumberInput_pb2.py +6 -6
  63. streamlit/proto/NumberInput_pb2.pyi +3 -3
  64. streamlit/proto/PlotlyChart_pb2.py +2 -2
  65. streamlit/proto/Radio_pb2.py +4 -4
  66. streamlit/proto/Radio_pb2.pyi +3 -3
  67. streamlit/proto/Selectbox_pb2.py +4 -4
  68. streamlit/proto/Selectbox_pb2.pyi +3 -6
  69. streamlit/proto/Slider_pb2.py +8 -8
  70. streamlit/proto/Slider_pb2.pyi +3 -3
  71. streamlit/proto/Snow_pb2.pyi +0 -2
  72. streamlit/proto/TextArea_pb2.py +4 -4
  73. streamlit/proto/TextArea_pb2.pyi +3 -3
  74. streamlit/proto/TextInput_pb2.py +6 -6
  75. streamlit/proto/TextInput_pb2.pyi +3 -3
  76. streamlit/proto/TimeInput_pb2.py +4 -4
  77. streamlit/proto/TimeInput_pb2.pyi +3 -3
  78. streamlit/proto/Video_pb2.py +2 -2
  79. streamlit/runtime/app_session.py +9 -1
  80. streamlit/static/index.html +2 -2
  81. streamlit/static/manifest.json +325 -310
  82. streamlit/static/static/css/{index.BUP6fTcR.css → index.C8MrxwGF.css} +1 -1
  83. streamlit/static/static/js/{ErrorOutline.esm.DC6KVDKK.js → ErrorOutline.esm.C9uHPmIj.js} +1 -1
  84. streamlit/static/static/js/{FileDownload.esm.Z9hRQIHi.js → FileDownload.esm.D-YPxF3t.js} +1 -1
  85. streamlit/static/static/js/{FileHelper.DqvW90pm.js → FileHelper.DQSH0zYW.js} +1 -1
  86. streamlit/static/static/js/{FormClearHelper.DTFnX0js.js → FormClearHelper.DQoXcOWo.js} +1 -1
  87. streamlit/static/static/js/{InputInstructions.CdzsN_Va.js → InputInstructions.C7VMyGT7.js} +1 -1
  88. streamlit/static/static/js/{Particles.12xFSjcn.js → Particles.BdQSRZde.js} +1 -1
  89. streamlit/static/static/js/{ProgressBar.Dg-oMbWg.js → ProgressBar.DNF_pWKr.js} +2 -2
  90. streamlit/static/static/js/{StreamlitSyntaxHighlighter.rbzmcipw.js → StreamlitSyntaxHighlighter.Cys9Bt18.js} +2 -2
  91. streamlit/static/static/js/{TableChart.esm.CzJtGIR-.js → TableChart.esm.B9SMgSK4.js} +1 -1
  92. streamlit/static/static/js/{Toolbar.COH7NaOE.js → Toolbar.BXfC9Z-W.js} +1 -1
  93. streamlit/static/static/js/{WidgetLabelHelpIconInline.Dlc8f0Ji.js → WidgetLabelHelpIconInline.gkreC55g.js} +1 -1
  94. streamlit/static/static/js/{base-input.Q-zJLgRK.js → base-input.iB32RS3w.js} +4 -4
  95. streamlit/static/static/js/{checkbox.BKgWNdeI.js → checkbox.Bqz68SYq.js} +1 -1
  96. streamlit/static/static/js/{createDownloadLinkElement.6oO-YlYv.js → createDownloadLinkElement.YxVC9Qur.js} +1 -1
  97. streamlit/static/static/js/data-grid-overlay-editor.sBsdk5Xg.js +1 -0
  98. streamlit/static/static/js/{downloader.BBXcXdX1.js → downloader.Bzxqt3AW.js} +1 -1
  99. streamlit/static/static/js/{embed.CJzOXYBF.js → embed.CDzakah3.js} +1 -1
  100. streamlit/static/static/js/{es6.CdxPQzwJ.js → es6.CxCc4bfn.js} +2 -2
  101. streamlit/static/static/js/formatNumber.L8T7D36k.js +1 -0
  102. streamlit/static/static/js/{iconPosition.BVScIr6G.js → iconPosition.C47DkA-1.js} +1 -1
  103. streamlit/static/static/js/{iframeResizer.contentWindow.D_QHVqPM.js → iframeResizer.contentWindow.uEFLXEg3.js} +1 -1
  104. streamlit/static/static/js/{index.CvtybR-u.js → index.B3zULhHv.js} +1 -1
  105. streamlit/static/static/js/{index.DAyGxxdm.js → index.B60AZFRh.js} +3 -3
  106. streamlit/static/static/js/{index.BED2_zc7.js → index.BG4RxMOI.js} +1 -1
  107. streamlit/static/static/js/{index.CPc_uZux.js → index.BHyzKS4e.js} +45 -45
  108. streamlit/static/static/js/{index.Dud7RRHc.js → index.BVTW_o-a.js} +1 -1
  109. streamlit/static/static/js/{index.BQnLeHnr.js → index.BV_YgIHe.js} +3 -3
  110. streamlit/static/static/js/index.B_LfkwqU.js +2 -0
  111. streamlit/static/static/js/{index.DCe7fo-m.js → index.Ba8L-ulI.js} +1 -1
  112. streamlit/static/static/js/{index.DAfIQKfP.js → index.Bh5BZaHG.js} +2 -2
  113. streamlit/static/static/js/{index.DU68jVpM.js → index.Bnwh8oZr.js} +16 -16
  114. streamlit/static/static/js/index.BrZtYm2A.js +2 -0
  115. streamlit/static/static/js/index.BsrhCS7f.js +1 -0
  116. streamlit/static/static/js/{index.CxoREvnF.js → index.BuJPJSD7.js} +2 -2
  117. streamlit/static/static/js/{index.6DFY6LUF.js → index.BvHsyiyy.js} +1 -1
  118. streamlit/static/static/js/{index.Biyf9aUg.js → index.BwTkGOAy.js} +2 -2
  119. streamlit/static/static/js/{index.DNfyKqhQ.js → index.BwvxzVOo.js} +1 -1
  120. streamlit/static/static/js/{index.iXh5nbLZ.js → index.BzdcdLDK.js} +1 -1
  121. streamlit/static/static/js/{index.YULCxEtm.js → index.C1d2QjTR.js} +1 -1
  122. streamlit/static/static/js/index.C1uZrWog.js +1 -0
  123. streamlit/static/static/js/{index.C5oqIM3a.js → index.C5-TpWis.js} +1 -1
  124. streamlit/static/static/js/{index.D6OexhdL.js → index.C6dhwBSe.js} +1 -1
  125. streamlit/static/static/js/{index.y-pa6LIX.js → index.CAbQaUvi.js} +1 -1
  126. streamlit/static/static/js/{index.BSpYHDvk.js → index.CAbafj7s.js} +1 -1
  127. streamlit/static/static/js/{index.BDtN2n7T.js → index.CCLteRW6.js} +1 -1
  128. streamlit/static/static/js/{index.mSdC1FV6.js → index.CQ713nQM.js} +1 -1
  129. streamlit/static/static/js/index.CcBYyLfq.js +2 -0
  130. streamlit/static/static/js/{index.CBE2cIbj.js → index.CjBDVb1a.js} +1 -1
  131. streamlit/static/static/js/{index.BxQxTpWl.js → index.Ck0ZkOfK.js} +1 -1
  132. streamlit/static/static/js/{index.B80gSxrS.js → index.CzwJzgQs.js} +1 -1
  133. streamlit/static/static/js/{index.DyfvmNCy.js → index.D-9VyyiA.js} +1 -1
  134. streamlit/static/static/js/{index.nL1fkE1D.js → index.D2R3Co5f.js} +1 -1
  135. streamlit/static/static/js/{index.DZmBuE3z.js → index.D7L9gHlE.js} +3 -3
  136. streamlit/static/static/js/{index.BqxwnMem.js → index.DEKnCsY-.js} +2 -2
  137. streamlit/static/static/js/{index.D9v2Y8Gk.js → index.DHrByikW.js} +1 -1
  138. streamlit/static/static/js/index.DN_oudQl.js +1 -0
  139. streamlit/static/static/js/{index.DrcbvB2t.js → index.DO55kRo5.js} +1 -1
  140. streamlit/static/static/js/{index.BqbKiDp2.js → index.D_cvtSlg.js} +1 -1
  141. streamlit/static/static/js/{index.CrY1BsL3.js → index.DgqmsDCJ.js} +1 -1
  142. streamlit/static/static/js/{index.BtOoVQt7.js → index.DjgdCvlK.js} +1 -1
  143. streamlit/static/static/js/{index.BxMkW82k.js → index.DqhZqWYB.js} +1 -1
  144. streamlit/static/static/js/{index.bQJYmJ2T.js → index.Dtbj_oyb.js} +1 -1
  145. streamlit/static/static/js/{index.CUYi3FrD.js → index.QXukCzoh.js} +1 -1
  146. streamlit/static/static/js/{index.BiCbrx53.js → index.XJY9qZ6a.js} +1 -1
  147. streamlit/static/static/js/{index.GieKl4BG.js → index.aZRhdEuX.js} +1 -1
  148. streamlit/static/static/js/{index._1zqETQ9.js → index.fUsWkW8E.js} +1 -1
  149. streamlit/static/static/js/index.h2N-W51I.js +11 -0
  150. streamlit/static/static/js/index.iUHLeAvv.js +1 -0
  151. streamlit/static/static/js/{index.DRoJNzFX.js → index.kBgXO7Vv.js} +1 -1
  152. streamlit/static/static/js/{index.BSYebegS.js → index.kEL0HsUR.js} +1 -1
  153. streamlit/static/static/js/index.w7yKy9fh.js +6 -0
  154. streamlit/static/static/js/{input.BcC6sPE_.js → input.BCHJn1Cw.js} +1 -1
  155. streamlit/static/static/js/{main.TU5_aabd.js → main.23ZP6f1E.js} +1 -1
  156. streamlit/static/static/js/{memory.By_OTlI4.js → memory.D8f8Q4mO.js} +1 -1
  157. streamlit/static/static/js/number-overlay-editor.ZWvSpjJ5.js +9 -0
  158. streamlit/static/static/js/{pandasStylerUtils.3IiIKU9-.js → pandasStylerUtils.DlZ2GBs_.js} +1 -1
  159. streamlit/static/static/js/{sandbox.DnxTbWzV.js → sandbox.BH6D3KL9.js} +1 -1
  160. streamlit/static/static/js/sprintfjs.CtrdaGLQ.js +1 -0
  161. streamlit/static/static/js/{styled-components.BeEcZ0vW.js → styled-components.iD1HRMLc.js} +1 -1
  162. streamlit/static/static/js/{throttle.emUyC44c.js → throttle.DR7d9vp_.js} +1 -1
  163. streamlit/static/static/js/{timepicker.DZ_ZufYF.js → timepicker.Bd34xjcG.js} +4 -4
  164. streamlit/static/static/js/{toConsumableArray.DDV1bN1-.js → toConsumableArray.BDTTq1c5.js} +2 -2
  165. streamlit/static/static/js/uniqueId.Bd_Iuzvc.js +1 -0
  166. streamlit/static/static/js/useBasicWidgetState.BXKaD8DQ.js +1 -0
  167. streamlit/static/static/js/{useIntlLocale.BBDLbTq9.js → useIntlLocale.CysOvegI.js} +1 -1
  168. streamlit/static/static/js/{useTextInputAutoExpand.BIApLJKn.js → useTextInputAutoExpand.CVd5Hf2S.js} +1 -1
  169. streamlit/static/static/js/{useUpdateUiValue.DQ4RuJNC.js → useUpdateUiValue.CIUgfO8X.js} +1 -1
  170. streamlit/static/static/js/{useWaveformController.B0olyXLQ.js → useWaveformController.CDLqlnLv.js} +1 -1
  171. streamlit/static/static/js/{withCalculatedWidth.DYeqePuh.js → withCalculatedWidth.Ce1Zblb2.js} +1 -1
  172. streamlit/static/static/js/{withFullScreenWrapper.DtkUCO_d.js → withFullScreenWrapper.DBm7N75M.js} +1 -1
  173. streamlit/static/static/media/MaterialSymbols-Rounded.CnH1S47a.woff2 +0 -0
  174. streamlit/testing/v1/app_test.py +21 -5
  175. streamlit/testing/v1/element_tree.py +65 -2
  176. streamlit/web/server/app_static_file_handler.py +9 -0
  177. streamlit/web/server/bidi_component_request_handler.py +4 -4
  178. streamlit/web/server/component_file_utils.py +14 -6
  179. streamlit/web/server/component_request_handler.py +2 -2
  180. streamlit/web/server/starlette/starlette_app.py +7 -1
  181. streamlit/web/server/starlette/starlette_path_security_middleware.py +97 -0
  182. streamlit/web/server/starlette/starlette_routes.py +6 -3
  183. streamlit/web/server/starlette/starlette_static_routes.py +14 -4
  184. {streamlit_nightly-1.53.2.dev20260131.dist-info → streamlit_nightly-1.53.2.dev20260203.dist-info}/METADATA +1 -1
  185. {streamlit_nightly-1.53.2.dev20260131.dist-info → streamlit_nightly-1.53.2.dev20260203.dist-info}/RECORD +188 -184
  186. streamlit/proto/BokehChart_pb2.pyi +0 -56
  187. streamlit/proto/LabelVisibilityMessage_pb2.py +0 -28
  188. streamlit/static/static/js/data-grid-overlay-editor.CO0xdNiG.js +0 -1
  189. streamlit/static/static/js/formatNumber.DB5irY8c.js +0 -1
  190. streamlit/static/static/js/index.BBTKOM0z.js +0 -6
  191. streamlit/static/static/js/index.CE2WIFD1.js +0 -2
  192. streamlit/static/static/js/index.Cpu2p5bH.js +0 -1
  193. streamlit/static/static/js/index.CtbETWQK.js +0 -2
  194. streamlit/static/static/js/index.DAnczAW2.js +0 -2
  195. streamlit/static/static/js/index.DhRAGiPR.js +0 -1
  196. streamlit/static/static/js/index.DyXcT2tD.js +0 -11
  197. streamlit/static/static/js/index.tuFFlbxa.js +0 -1
  198. streamlit/static/static/js/number-overlay-editor.FSRaRpbU.js +0 -9
  199. streamlit/static/static/js/sprintf.DpPCfzXw.js +0 -1
  200. streamlit/static/static/js/uniqueId.DTwvAE-J.js +0 -1
  201. streamlit/static/static/js/useBasicWidgetState.DvpdEDYZ.js +0 -1
  202. streamlit/static/static/media/MaterialSymbols-Rounded.C7IFxh57.woff2 +0 -0
  203. {streamlit_nightly-1.53.2.dev20260131.dist-info → streamlit_nightly-1.53.2.dev20260203.dist-info}/WHEEL +0 -0
  204. {streamlit_nightly-1.53.2.dev20260131.dist-info → streamlit_nightly-1.53.2.dev20260203.dist-info}/entry_points.txt +0 -0
  205. {streamlit_nightly-1.53.2.dev20260131.dist-info → streamlit_nightly-1.53.2.dev20260203.dist-info}/top_level.txt +0 -0
@@ -1,2 +1,2 @@
1
- import{J as P,r as u,V as ao,cu as L,cv as co,aL as io,l as lo,j as m,W as U,R as fo,cw as go,z as _,aM as V}from"./index.CPc_uZux.js";function Co(o,e,r,n){for(var t=-1,s=o==null?0:o.length;++t<s;)r=e(r,o[t],t,o);return r}function xo(o){return function(e){return o?.[e]}}var po={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ho=xo(po),mo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,bo="\\u0300-\\u036f",So="\\ufe20-\\ufe2f",Ro="\\u20d0-\\u20ff",yo=bo+So+Ro,Eo="["+yo+"]",Fo=RegExp(Eo,"g");function wo(o){return o=P(o),o&&o.replace(mo,ho).replace(Fo,"")}var vo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function ko(o){return o.match(vo)||[]}var Bo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function To(o){return Bo.test(o)}var H="\\ud800-\\udfff",zo="\\u0300-\\u036f",Ao="\\ufe20-\\ufe2f",Uo="\\u20d0-\\u20ff",Io=zo+Ao+Uo,J="\\u2700-\\u27bf",Z="a-z\\xdf-\\xf6\\xf8-\\xff",Wo="\\xac\\xb1\\xd7\\xf7",Lo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Oo="\\u2000-\\u206f",Mo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",G="A-Z\\xc0-\\xd6\\xd8-\\xde",jo="\\ufe0e\\ufe0f",Y=Wo+Lo+Oo+Mo,q="['’]",O="["+Y+"]",$o="["+Io+"]",K="\\d+",No="["+J+"]",X="["+Z+"]",Q="[^"+H+Y+K+J+Z+G+"]",Do="\\ud83c[\\udffb-\\udfff]",Po="(?:"+$o+"|"+Do+")",_o="[^"+H+"]",oo="(?:\\ud83c[\\udde6-\\uddff]){2}",eo="[\\ud800-\\udbff][\\udc00-\\udfff]",w="["+G+"]",Vo="\\u200d",M="(?:"+X+"|"+Q+")",Ho="(?:"+w+"|"+Q+")",j="(?:"+q+"(?:d|ll|m|re|s|t|ve))?",$="(?:"+q+"(?:D|LL|M|RE|S|T|VE))?",ro=Po+"?",to="["+jo+"]?",Jo="(?:"+Vo+"(?:"+[_o,oo,eo].join("|")+")"+to+ro+")*",Zo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Go="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Yo=to+ro+Jo,qo="(?:"+[No,oo,eo].join("|")+")"+Yo,Ko=RegExp([w+"?"+X+"+"+j+"(?="+[O,w,"$"].join("|")+")",Ho+"+"+$+"(?="+[O,w+M,"$"].join("|")+")",w+"?"+M+"+"+j,w+"+"+$,Go,Zo,K,qo].join("|"),"g");function Xo(o){return o.match(Ko)||[]}function Qo(o,e,r){return o=P(o),e=e,e===void 0?To(o)?Xo(o):ko(o):o.match(e)||[]}var oe="['’]",ee=RegExp(oe,"g");function re(o){return function(e){return Co(Qo(wo(e).replace(ee,"")),o,"")}}var te=re(function(o,e,r){return o+(r?"-":"")+e.toLowerCase()});const k=u.createContext(null);k.displayName="BidiComponentContext";const v=ao.getLogger("BidiComponent"),N="__",z="__streamlit_arrow_ref__",ne="$$STREAMLIT_INTERNAL_KEY",se=(o,e)=>{if(o&&typeof o=="object"&&!Array.isArray(o)){if(typeof o[z]=="string"){const n=o[z],t=e[n];if(t)try{return L(t)}catch{return null}return null}const r={};for(const[n,t]of Object.entries(o))if(t&&typeof t=="object"&&!Array.isArray(t)&&typeof t[z]=="string"){const s=t[z],a=e[s];if(a)try{r[n]=L(a)}catch{r[n]=null}else r[n]=null}else r[n]=t;return r}return o},ue=({arrowBlobs:o,arrowData:e,bytes:r,data:n,json:t,mixedJson:s})=>{switch(n){case"json":return t?JSON.parse(t):null;case"arrowData":return e??null;case"bytes":return r??null;case"mixed":{if(s&&o){const a=JSON.parse(s),i={};return Object.entries(o).forEach(([l,d])=>{d?.data&&(i[l]=d.data)}),se(a,i)}return null}case"any":case void 0:return null;default:co(n)}},ae=(o,e="--st")=>{const r={};return Object.entries(o).forEach(([n,t])=>{const s=te(n),a=`${e}-${s}`;if(typeof t=="boolean"){r[a]=t?"1":"0";return}if(t==null){r[a]="unset";return}if(Array.isArray(t)){r[a]=t.join(",");return}if(typeof t=="number"||typeof t=="string"){r[a]=String(t);return}r[a]="unset"}),r},ce=o=>{const e=[o.fontSizes.h1FontSize,o.fontSizes.h2FontSize,o.fontSizes.h3FontSize,o.fontSizes.h4FontSize,o.fontSizes.h5FontSize,o.fontSizes.h6FontSize],r=[o.fontWeights.h1FontWeight,o.fontWeights.h2FontWeight,o.fontWeights.h3FontWeight,o.fontWeights.h4FontWeight,o.fontWeights.h5FontWeight,o.fontWeights.h6FontWeight];return{primaryColor:o.colors.primary,backgroundColor:o.colors.bgColor,secondaryBackgroundColor:o.colors.secondaryBg,textColor:o.colors.bodyText,linkColor:o.colors.link,linkUnderline:o.linkUnderline,headingFont:o.genericFonts.headingFont,codeFont:o.genericFonts.codeFont,baseRadius:o.radii.default,buttonRadius:o.radii.button,baseFontSize:typeof o.fontSizes.baseFontSize=="number"?`${o.fontSizes.baseFontSize}px`:String(o.fontSizes.baseFontSize),baseFontWeight:o.fontWeights.normal,codeFontWeight:o.fontWeights.code,codeFontSize:o.fontSizes.codeFontSize,headingFontSizes:e,headingFontSize1:e[0],headingFontSize2:e[1],headingFontSize3:e[2],headingFontSize4:e[3],headingFontSize5:e[4],headingFontSize6:e[5],headingFontWeights:r,headingFontWeight1:r[0],headingFontWeight2:r[1],headingFontWeight3:r[2],headingFontWeight4:r[3],headingFontWeight5:r[4],headingFontWeight6:r[5],borderColor:o.colors.borderColor,dataframeBorderColor:o.colors.dataframeBorderColor,dataframeHeaderBackgroundColor:o.colors.dataframeHeaderBackgroundColor,codeBackgroundColor:o.colors.codeBackgroundColor,font:o.genericFonts.bodyFont,chartCategoricalColors:o.colors.chartCategoricalColors,chartSequentialColors:o.colors.chartSequentialColors,chartDivergingColors:o.colors.chartDivergingColors,headingColor:o.colors.headingColor,borderColorLight:o.colors.borderColorLight,codeTextColor:o.colors.codeTextColor,widgetBorderColor:o.colors.widgetBorderColor||"transparent",redColor:o.colors.redColor,orangeColor:o.colors.orangeColor,yellowColor:o.colors.yellowColor,blueColor:o.colors.blueColor,greenColor:o.colors.greenColor,violetColor:o.colors.violetColor,grayColor:o.colors.grayColor,redBackgroundColor:o.colors.redBackgroundColor,orangeBackgroundColor:o.colors.orangeBackgroundColor,yellowBackgroundColor:o.colors.yellowBackgroundColor,blueBackgroundColor:o.colors.blueBackgroundColor,greenBackgroundColor:o.colors.greenBackgroundColor,violetBackgroundColor:o.colors.violetBackgroundColor,grayBackgroundColor:o.colors.grayBackgroundColor,redTextColor:o.colors.redTextColor,orangeTextColor:o.colors.orangeTextColor,yellowTextColor:o.colors.yellowTextColor,blueTextColor:o.colors.blueTextColor,greenTextColor:o.colors.greenTextColor,violetTextColor:o.colors.violetTextColor,grayTextColor:o.colors.grayTextColor}},ie=u.memo(({element:o,children:e,widgetMgr:r,fragmentId:n,componentRegistry:t})=>{const{arrowData:s,bytes:a,componentName:i,cssContent:l,cssSourcePath:d,data:f,htmlContent:g,id:c,jsContent:b,json:p,jsSourcePath:h,mixed:C}=o,y=u.useMemo(()=>({id:o.id,formId:o.formId}),[o.id,o.formId]),B=u.useCallback(()=>{const F=r.getJsonValue(y);if(!F)return{};try{return JSON.parse(F)}catch(I){const R=io(I);return v.warn("Failed to parse widget JSON value; returning empty object.",{widgetId:y.id,formId:y.formId,error:R.message}),{}}},[y,r]),T=u.useMemo(()=>ue({arrowBlobs:C?.arrowBlobs||void 0,arrowData:s?.data||void 0,bytes:a,data:f,json:p,mixedJson:C?.json||void 0}),[f,p,s?.data,a,C?.json,C?.arrowBlobs]),S=lo(),E=u.useMemo(()=>ce(S),[S]),x=u.useMemo(()=>({componentName:i,componentRegistry:t,cssContent:l?.trim(),cssSourcePath:d||void 0,data:T,fragmentId:n,getWidgetValue:B,htmlContent:g?.trim(),id:c,formId:o.formId||void 0,jsContent:b||void 0,jsSourcePath:h||void 0,theme:E,widgetMgr:r}),[i,t,l,d,n,B,g,c,o.formId,b,h,T,E,r]);return m(k.Provider,{value:x,children:e})}),no=(o,e)=>{if(o instanceof Error)return o;const r=e?`${e}: ${String(o)}`:String(o);return new Error(r)},A=(o,e,r)=>{const n=no(o,r);v.error(`BidiComponent Error: ${n.message}`,o),e(n)},de=(o,e)=>{try{const n=document.createRange().createContextualFragment(o);e.appendChild(n)}catch(r){v.warn("createContextualFragment failed, falling back to innerHTML",r),e.innerHTML=o}},so=({containerRef:o,setError:e,skip:r=!1})=>{const n=u.useRef(null),{htmlContent:t,cssContent:s,cssSourcePath:a,componentName:i,componentRegistry:{getBidiComponentURL:l}}=U(k),d=u.useMemo(()=>{if(a)return l(i,a)},[i,a,l]),f=fo(d);return u.useEffect(()=>{if(r)return;const g=o.current;if(g)try{if(n.current?.parentNode===g&&g.removeChild(n.current),n.current=document.createElement("div"),t){const c=document.createElement("div");de(t,c),n.current.appendChild(c)}if(s){const c=document.createElement("style");c.textContent=s,n.current.appendChild(c)}else if(d){const c=document.createElement("link");c.href=d,c.rel="stylesheet",f&&(c.crossOrigin=f),c.onerror=()=>{A(new Error(`Failed to load CSS from ${d}`),e)},n.current.appendChild(c)}g.appendChild(n.current)}catch(c){A(c,e,"Failed to process HTML/CSS content")}},[t,s,o,f,d,e,r]),n};class le{constructor(){this.hashSeed=2166136261,this.hashPrime=16777619,this.cache=new Map}computeHash(e){let r=this.hashSeed;for(let n=0;n<e.length;n++)r^=e.charCodeAt(n),r=Math.imul(r>>>0,this.hashPrime)>>>0;return(r>>>0).toString(16)}getOrCreateUrlForJs(e,r){const n=this.computeHash(e),t=this.cache.get(n);if(t)return{url:t,hash:n};const s=`${e}
2
- //# sourceURL=${r}-${n}.js`,a=new Blob([s],{type:"text/javascript"}),i=URL.createObjectURL(a);return this.cache.set(n,i),{url:i,hash:n}}}const fe=new le,ge="events";function Ce(o){if(o.includes(N))throw new Error("Base component id must not contain the delimiter sequence");return`${ne}_${o}${N}${ge}`}const D=async({componentId:o,componentIdForWidgetMgr:e,componentName:r,data:n,formId:t,fragmentId:s,getWidgetValue:a,moduleUrl:i,parentElement:l,widgetMgr:d})=>{const f=await import(i);if(!f)throw new Error("JS module does not exist.");if(!f.default||typeof f.default!="function")throw new Error("JS module does not have a default export function.");const g=(b,p)=>{let h={};try{h={...a(),[b]:p}}catch(C){v.error(`Failed to get existing value for ${b}`,C),h={[b]:p}}d.setJsonValue({id:e,formId:t},h,{fromUi:!0},s)},c=(b,p)=>{if(t){v.warn("BidiComponent: setTriggerValue ignored inside st.form. Triggers are not allowed in forms; use setStateValue and form submit instead.");return}const h=Ce(e);d.setTriggerValue({id:h,formId:t},{fromUi:!0},s,{event:b,value:p})};return f.default({name:r,data:n,key:o,parentElement:l,setStateValue:g,setTriggerValue:c})},uo=({containerRef:o,setError:e,skip:r=!1})=>{const t=`st-bidi-component-${u.useMemo(()=>go(),[])}`,{componentName:s,data:a,formId:i,fragmentId:l,getWidgetValue:d,id:f,jsContent:g,jsSourcePath:c,theme:b,widgetMgr:p,componentRegistry:{getBidiComponentURL:h}}=U(k),C=u.useMemo(()=>{if(c)return h(s,c)},[s,c,h]),y=u.useRef(),B=u.useRef(),T=u.useRef(!1);u.useEffect(()=>{const{current:S}=o;if(r||!g&&!C||!S)return;(async()=>{try{if(g){const{url:x}=fe.getOrCreateUrlForJs(g,`st-bidi-${s}`);y.current=await D({componentId:t,componentIdForWidgetMgr:f,componentName:s,data:a,formId:i,fragmentId:l,getWidgetValue:d,moduleUrl:x,parentElement:S,widgetMgr:p})}else if(C){const x=C;try{await new Promise((F,I)=>{const R=document.createElement("script");R.type="module",R.src=x,R.async=!0,R.onload=()=>F(),R.onerror=()=>I(new Error(`Failed to load script from ${C}`)),document.head.appendChild(R),B.current=R}),y.current=await D({componentId:t,componentIdForWidgetMgr:f,componentName:s,data:a,formId:i,fragmentId:l,getWidgetValue:d,moduleUrl:x,parentElement:S,widgetMgr:p})}catch(F){throw no(F,`Failed to load or execute script from ${C}`)}}}catch(x){T.current||A(x,e)}})()},[t,s,o,a,i,l,d,f,g,C,e,r,p,b]),u.useEffect(()=>()=>{T.current=!0;const S=y.current;S&&Promise.resolve(S).then(x=>{x?.()}).catch(x=>{v.error("Failed to run custom component cleanup",x)});const E=B.current;E?.parentNode&&E.parentNode.removeChild(E)},[])},xe=_("div",{target:"epzkg1s0"})(({cssCustomProperties:o})=>({...o,display:"contents"})),W=_("div",{target:"epzkg1s1"})({width:"100%",height:"100%"}),pe=u.memo(()=>{const o=u.useRef(null),e=u.useRef(null),[r,n]=u.useState(!1),[t,s]=u.useState(null),{id:a}=U(k);u.useEffect(()=>{if(o.current)try{if(o.current.shadowRoot){e.current=o.current.shadowRoot,n(!0);return}e.current=o.current.attachShadow({mode:"open"}),n(!0)}catch(l){A(l,s,"Failed to create shadow DOM")}},[a]);const i=!r||!!t;return so({containerRef:e,setError:s,skip:i}),uo({containerRef:e,setError:s,skip:i}),t?m(V,{name:"BidiComponent Error",message:t.message,stack:t.stack}):m(W,{ref:o,"data-testid":"stBidiComponentIsolated"})}),he=u.memo(()=>{const o=u.useRef(null),[e,r]=u.useState(null),n=!!e;return so({containerRef:o,setError:r,skip:n}),uo({containerRef:o,setError:r,skip:n}),e?m(V,{name:"BidiComponent Error",message:e.message,stack:e.stack}):m(W,{ref:o,"data-testid":"stBidiComponentRegular"})}),me=({children:o})=>{const{theme:e}=U(k),r=u.useMemo(()=>ae(e),[e]);return m(xe,{cssCustomProperties:r,children:o})},be=({element:o,widgetMgr:e,fragmentId:r,componentRegistry:n})=>{const{isolateStyles:t}=o;return m(ie,{element:o,widgetMgr:e,fragmentId:r,componentRegistry:n,children:m(W,{className:"stBidiComponent",children:m(me,{children:t?m(pe,{}):m(he,{})})})})},Re=u.memo(be);export{k as BidiComponentContext,Re as default};
1
+ import{J as P,r as u,V as ao,cw as W,cx as co,aN as io,l as lo,j as m,W as U,R as fo,cy as go,z as _,aO as V}from"./index.BHyzKS4e.js";function Co(o,e,r,n){for(var t=-1,s=o==null?0:o.length;++t<s;)r=e(r,o[t],t,o);return r}function xo(o){return function(e){return o?.[e]}}var po={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ho=xo(po),mo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,bo="\\u0300-\\u036f",So="\\ufe20-\\ufe2f",yo="\\u20d0-\\u20ff",Ro=bo+So+yo,Eo="["+Ro+"]",Fo=RegExp(Eo,"g");function wo(o){return o=P(o),o&&o.replace(mo,ho).replace(Fo,"")}var vo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function ko(o){return o.match(vo)||[]}var Bo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function To(o){return Bo.test(o)}var H="\\ud800-\\udfff",zo="\\u0300-\\u036f",Ao="\\ufe20-\\ufe2f",Uo="\\u20d0-\\u20ff",Io=zo+Ao+Uo,J="\\u2700-\\u27bf",Z="a-z\\xdf-\\xf6\\xf8-\\xff",Oo="\\xac\\xb1\\xd7\\xf7",Wo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Lo="\\u2000-\\u206f",Mo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",G="A-Z\\xc0-\\xd6\\xd8-\\xde",jo="\\ufe0e\\ufe0f",Y=Oo+Wo+Lo+Mo,q="['’]",L="["+Y+"]",$o="["+Io+"]",K="\\d+",No="["+J+"]",X="["+Z+"]",Q="[^"+H+Y+K+J+Z+G+"]",Do="\\ud83c[\\udffb-\\udfff]",Po="(?:"+$o+"|"+Do+")",_o="[^"+H+"]",oo="(?:\\ud83c[\\udde6-\\uddff]){2}",eo="[\\ud800-\\udbff][\\udc00-\\udfff]",w="["+G+"]",Vo="\\u200d",M="(?:"+X+"|"+Q+")",Ho="(?:"+w+"|"+Q+")",j="(?:"+q+"(?:d|ll|m|re|s|t|ve))?",$="(?:"+q+"(?:D|LL|M|RE|S|T|VE))?",ro=Po+"?",to="["+jo+"]?",Jo="(?:"+Vo+"(?:"+[_o,oo,eo].join("|")+")"+to+ro+")*",Zo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Go="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Yo=to+ro+Jo,qo="(?:"+[No,oo,eo].join("|")+")"+Yo,Ko=RegExp([w+"?"+X+"+"+j+"(?="+[L,w,"$"].join("|")+")",Ho+"+"+$+"(?="+[L,w+M,"$"].join("|")+")",w+"?"+M+"+"+j,w+"+"+$,Go,Zo,K,qo].join("|"),"g");function Xo(o){return o.match(Ko)||[]}function Qo(o,e,r){return o=P(o),e=e,e===void 0?To(o)?Xo(o):ko(o):o.match(e)||[]}var oe="['’]",ee=RegExp(oe,"g");function re(o){return function(e){return Co(Qo(wo(e).replace(ee,"")),o,"")}}var te=re(function(o,e,r){return o+(r?"-":"")+e.toLowerCase()});const k=u.createContext(null);k.displayName="BidiComponentContext";const v=ao.getLogger("BidiComponent"),N="__",z="__streamlit_arrow_ref__",ne="$$STREAMLIT_INTERNAL_KEY",se=(o,e)=>{if(o&&typeof o=="object"&&!Array.isArray(o)){if(typeof o[z]=="string"){const n=o[z],t=e[n];if(t)try{return W(t)}catch{return null}return null}const r={};for(const[n,t]of Object.entries(o))if(t&&typeof t=="object"&&!Array.isArray(t)&&typeof t[z]=="string"){const s=t[z],a=e[s];if(a)try{r[n]=W(a)}catch{r[n]=null}else r[n]=null}else r[n]=t;return r}return o},ue=({arrowBlobs:o,arrowData:e,bytes:r,data:n,json:t,mixedJson:s})=>{switch(n){case"json":return t?JSON.parse(t):null;case"arrowData":return e??null;case"bytes":return r??null;case"mixed":{if(s&&o){const a=JSON.parse(s),i={};return Object.entries(o).forEach(([l,d])=>{d?.data&&(i[l]=d.data)}),se(a,i)}return null}case"any":case void 0:return null;default:co(n)}},ae=(o,e="--st")=>{const r={};return Object.entries(o).forEach(([n,t])=>{const s=te(n),a=`${e}-${s}`;if(typeof t=="boolean"){r[a]=t?"1":"0";return}if(t==null){r[a]="unset";return}if(Array.isArray(t)){r[a]=t.join(",");return}if(typeof t=="number"||typeof t=="string"){r[a]=String(t);return}r[a]="unset"}),r},ce=o=>{const e=[o.fontSizes.h1FontSize,o.fontSizes.h2FontSize,o.fontSizes.h3FontSize,o.fontSizes.h4FontSize,o.fontSizes.h5FontSize,o.fontSizes.h6FontSize],r=[o.fontWeights.h1FontWeight,o.fontWeights.h2FontWeight,o.fontWeights.h3FontWeight,o.fontWeights.h4FontWeight,o.fontWeights.h5FontWeight,o.fontWeights.h6FontWeight];return{primaryColor:o.colors.primary,backgroundColor:o.colors.bgColor,secondaryBackgroundColor:o.colors.secondaryBg,textColor:o.colors.bodyText,linkColor:o.colors.link,linkUnderline:o.linkUnderline,headingFont:o.genericFonts.headingFont,codeFont:o.genericFonts.codeFont,baseRadius:o.radii.default,buttonRadius:o.radii.button,baseFontSize:typeof o.fontSizes.baseFontSize=="number"?`${o.fontSizes.baseFontSize}px`:String(o.fontSizes.baseFontSize),baseFontWeight:o.fontWeights.normal,codeFontWeight:o.fontWeights.code,codeFontSize:o.fontSizes.codeFontSize,headingFontSizes:e,headingFontSize1:e[0],headingFontSize2:e[1],headingFontSize3:e[2],headingFontSize4:e[3],headingFontSize5:e[4],headingFontSize6:e[5],headingFontWeights:r,headingFontWeight1:r[0],headingFontWeight2:r[1],headingFontWeight3:r[2],headingFontWeight4:r[3],headingFontWeight5:r[4],headingFontWeight6:r[5],borderColor:o.colors.borderColor,dataframeBorderColor:o.colors.dataframeBorderColor,dataframeHeaderBackgroundColor:o.colors.dataframeHeaderBackgroundColor,codeBackgroundColor:o.colors.codeBackgroundColor,font:o.genericFonts.bodyFont,chartCategoricalColors:o.colors.chartCategoricalColors,chartSequentialColors:o.colors.chartSequentialColors,chartDivergingColors:o.colors.chartDivergingColors,headingColor:o.colors.headingColor,borderColorLight:o.colors.borderColorLight,codeTextColor:o.colors.codeTextColor,widgetBorderColor:o.colors.widgetBorderColor||"transparent",redColor:o.colors.redColor,orangeColor:o.colors.orangeColor,yellowColor:o.colors.yellowColor,blueColor:o.colors.blueColor,greenColor:o.colors.greenColor,violetColor:o.colors.violetColor,grayColor:o.colors.grayColor,redBackgroundColor:o.colors.redBackgroundColor,orangeBackgroundColor:o.colors.orangeBackgroundColor,yellowBackgroundColor:o.colors.yellowBackgroundColor,blueBackgroundColor:o.colors.blueBackgroundColor,greenBackgroundColor:o.colors.greenBackgroundColor,violetBackgroundColor:o.colors.violetBackgroundColor,grayBackgroundColor:o.colors.grayBackgroundColor,redTextColor:o.colors.redTextColor,orangeTextColor:o.colors.orangeTextColor,yellowTextColor:o.colors.yellowTextColor,blueTextColor:o.colors.blueTextColor,greenTextColor:o.colors.greenTextColor,violetTextColor:o.colors.violetTextColor,grayTextColor:o.colors.grayTextColor}},ie=u.memo(({element:o,children:e,widgetMgr:r,fragmentId:n,componentRegistry:t})=>{const{arrowData:s,bytes:a,componentName:i,cssContent:l,cssSourcePath:d,data:f,htmlContent:g,id:c,jsContent:b,json:p,jsSourcePath:h,mixed:C}=o,R=u.useMemo(()=>({id:o.id,formId:o.formId}),[o.id,o.formId]),B=u.useCallback(()=>{const F=r.getJsonValue(R);if(!F)return{};try{return JSON.parse(F)}catch(I){const y=io(I);return v.warn("Failed to parse widget JSON value; returning empty object.",{widgetId:R.id,formId:R.formId,error:y.message}),{}}},[R,r]),T=u.useMemo(()=>ue({arrowBlobs:C?.arrowBlobs||void 0,arrowData:s?.data||void 0,bytes:a,data:f,json:p,mixedJson:C?.json||void 0}),[f,p,s?.data,a,C?.json,C?.arrowBlobs]),S=lo(),E=u.useMemo(()=>ce(S),[S]),x=u.useMemo(()=>({componentName:i,componentRegistry:t,cssContent:l?.trim(),cssSourcePath:d||void 0,data:T,fragmentId:n,getWidgetValue:B,htmlContent:g?.trim(),id:c,formId:o.formId||void 0,jsContent:b||void 0,jsSourcePath:h||void 0,theme:E,widgetMgr:r}),[i,t,l,d,n,B,g,c,o.formId,b,h,T,E,r]);return m(k.Provider,{value:x,children:e})}),no=(o,e)=>{if(o instanceof Error)return o;const r=e?`${e}: ${String(o)}`:String(o);return new Error(r)},A=(o,e,r)=>{const n=no(o,r);v.error(`BidiComponent Error: ${n.message}`,o),e(n)},de=(o,e)=>{try{const n=document.createRange().createContextualFragment(o);e.appendChild(n)}catch(r){v.warn("createContextualFragment failed, falling back to innerHTML",r),e.innerHTML=o}},so=({containerRef:o,setError:e,skip:r=!1})=>{const n=u.useRef(null),{htmlContent:t,cssContent:s,cssSourcePath:a,componentName:i,componentRegistry:{getBidiComponentURL:l}}=U(k),d=u.useMemo(()=>{if(a)return l(i,a)},[i,a,l]),f=fo(d);return u.useEffect(()=>{if(r)return;const g=o.current;if(g)try{if(n.current?.parentNode===g&&g.removeChild(n.current),n.current=document.createElement("div"),t){const c=document.createElement("div");de(t,c),n.current.appendChild(c)}if(s){const c=document.createElement("style");c.textContent=s,n.current.appendChild(c)}else if(d){const c=document.createElement("link");c.href=d,c.rel="stylesheet",f&&(c.crossOrigin=f),c.onerror=()=>{A(new Error(`Failed to load CSS from ${d}`),e)},n.current.appendChild(c)}g.appendChild(n.current)}catch(c){A(c,e,"Failed to process HTML/CSS content")}},[t,s,o,f,d,e,r]),n};class le{constructor(){this.hashSeed=2166136261,this.hashPrime=16777619,this.cache=new Map}computeHash(e){let r=this.hashSeed;for(let n=0;n<e.length;n++)r^=e.charCodeAt(n),r=Math.imul(r>>>0,this.hashPrime)>>>0;return(r>>>0).toString(16)}getOrCreateUrlForJs(e,r){const n=this.computeHash(e),t=this.cache.get(n);if(t)return{url:t,hash:n};const s=`${e}
2
+ //# sourceURL=${r}-${n}.js`,a=new Blob([s],{type:"text/javascript"}),i=URL.createObjectURL(a);return this.cache.set(n,i),{url:i,hash:n}}}const fe=new le,ge="events";function Ce(o){if(o.includes(N))throw new Error("Base component id must not contain the delimiter sequence");return`${ne}_${o}${N}${ge}`}const D=async({componentId:o,componentIdForWidgetMgr:e,componentName:r,data:n,formId:t,fragmentId:s,getWidgetValue:a,moduleUrl:i,parentElement:l,widgetMgr:d})=>{const f=await import(i);if(!f)throw new Error("JS module does not exist.");if(!f.default||typeof f.default!="function")throw new Error("JS module does not have a default export function.");const g=(b,p)=>{let h={};try{h={...a(),[b]:p}}catch(C){v.error(`Failed to get existing value for ${b}`,C),h={[b]:p}}d.setJsonValue({id:e,formId:t},h,{fromUi:!0},s)},c=(b,p)=>{if(t){v.warn("BidiComponent: setTriggerValue ignored inside st.form. Triggers are not allowed in forms; use setStateValue and form submit instead.");return}const h=Ce(e);d.setTriggerValue({id:h,formId:t},{fromUi:!0},s,{event:b,value:p})};return f.default({name:r,data:n,key:o,parentElement:l,setStateValue:g,setTriggerValue:c})},uo=({containerRef:o,setError:e,skip:r=!1})=>{const t=`st-bidi-component-${u.useMemo(()=>go(),[])}`,{componentName:s,data:a,formId:i,fragmentId:l,getWidgetValue:d,id:f,jsContent:g,jsSourcePath:c,theme:b,widgetMgr:p,componentRegistry:{getBidiComponentURL:h}}=U(k),C=u.useMemo(()=>{if(c)return h(s,c)},[s,c,h]),R=u.useRef(),B=u.useRef(),T=u.useRef(!1);u.useEffect(()=>{const{current:S}=o;if(r||!g&&!C||!S)return;(async()=>{try{if(g){const{url:x}=fe.getOrCreateUrlForJs(g,`st-bidi-${s}`);R.current=await D({componentId:t,componentIdForWidgetMgr:f,componentName:s,data:a,formId:i,fragmentId:l,getWidgetValue:d,moduleUrl:x,parentElement:S,widgetMgr:p})}else if(C){const x=C;try{await new Promise((F,I)=>{const y=document.createElement("script");y.type="module",y.src=x,y.async=!0,y.onload=()=>F(),y.onerror=()=>I(new Error(`Failed to load script from ${C}`)),document.head.appendChild(y),B.current=y}),R.current=await D({componentId:t,componentIdForWidgetMgr:f,componentName:s,data:a,formId:i,fragmentId:l,getWidgetValue:d,moduleUrl:x,parentElement:S,widgetMgr:p})}catch(F){throw no(F,`Failed to load or execute script from ${C}`)}}}catch(x){T.current||A(x,e)}})()},[t,s,o,a,i,l,d,f,g,C,e,r,p,b]),u.useEffect(()=>()=>{T.current=!0;const S=R.current;S&&Promise.resolve(S).then(x=>{x?.()}).catch(x=>{v.error("Failed to run custom component cleanup",x)});const E=B.current;E?.parentNode&&E.parentNode.removeChild(E)},[])},xe=_("div",{target:"epzkg1s0"})(({cssCustomProperties:o})=>({...o,display:"contents"})),O=_("div",{target:"epzkg1s1"})({width:"100%",height:"100%"}),pe=u.memo(()=>{const o=u.useRef(null),e=u.useRef(null),[r,n]=u.useState(!1),[t,s]=u.useState(null),{id:a}=U(k);u.useEffect(()=>{if(o.current)try{if(o.current.shadowRoot){e.current=o.current.shadowRoot,n(!0);return}e.current=o.current.attachShadow({mode:"open"}),n(!0)}catch(l){A(l,s,"Failed to create shadow DOM")}},[a]);const i=!r||!!t;return so({containerRef:e,setError:s,skip:i}),uo({containerRef:e,setError:s,skip:i}),t?m(V,{name:"BidiComponent Error",message:t.message,stack:t.stack}):m(O,{ref:o,"data-testid":"stBidiComponentIsolated"})}),he=u.memo(()=>{const o=u.useRef(null),[e,r]=u.useState(null),n=!!e;return so({containerRef:o,setError:r,skip:n}),uo({containerRef:o,setError:r,skip:n}),e?m(V,{name:"BidiComponent Error",message:e.message,stack:e.stack}):m(O,{ref:o,"data-testid":"stBidiComponentRegular"})}),me=({children:o})=>{const{theme:e}=U(k),r=u.useMemo(()=>ae(e),[e]);return m(xe,{cssCustomProperties:r,children:o})},be=({element:o,widgetMgr:e,fragmentId:r,componentRegistry:n})=>{const{isolateStyles:t}=o;return m(ie,{element:o,widgetMgr:e,fragmentId:r,componentRegistry:n,children:m(O,{className:"stBidiComponent",children:m(me,{children:t?m(pe,{}):m(he,{})})})})},ye=u.memo(be);export{k as BidiComponentContext,ye as default};
@@ -1 +1 @@
1
- import{r as h,l as A,az as ht,L as gt,e as tt,o as mt,j as T,p as wt,ab as bt,ac as pt,aw as yt,ae as Dt,ay as Ot,P as xt,ax as kt,q as St,m as Tt}from"./index.CPc_uZux.js";import{h as P}from"./moment.C7qA8nIE.js";import{u as Mt}from"./useBasicWidgetState.DvpdEDYZ.js";import{e as Ct,u as Yt,D as Wt,a as Et}from"./useIntlLocale.BBDLbTq9.js";import{E as Pt}from"./ErrorOutline.esm.DC6KVDKK.js";import"./FormClearHelper.DTFnX0js.js";import"./timepicker.DZ_ZufYF.js";import"./input.BcC6sPE_.js";import"./base-input.Q-zJLgRK.js";const et=6048e5,vt=864e5,X=Symbol.for("constructDateFrom");function O(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&X in e?e[X](t):e instanceof Date?new e.constructor(t):new Date(t)}function p(e,t){return O(t||e,e)}let Ft={};function I(){return Ft}function v(e,t){const r=I(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=p(e,t?.in),o=a.getDay(),i=(o<n?7:0)+o-n;return a.setDate(a.getDate()-i),a.setHours(0,0,0,0),a}function F(e,t){return v(e,{...t,weekStartsOn:1})}function rt(e,t){const r=p(e,t?.in),n=r.getFullYear(),a=O(r,0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);const o=F(a),i=O(r,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const f=F(i);return r.getTime()>=o.getTime()?n+1:r.getTime()>=f.getTime()?n:n-1}function V(e){const t=p(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function It(e,...t){const r=O.bind(null,t.find(n=>typeof n=="object"));return t.map(r)}function j(e,t){const r=p(e,t?.in);return r.setHours(0,0,0,0),r}function Bt(e,t,r){const[n,a]=It(r?.in,e,t),o=j(n),i=j(a),f=+o-V(o),g=+i-V(i);return Math.round((f-g)/vt)}function Ht(e,t){const r=rt(e,t),n=O(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),F(n)}function qt(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Lt(e){return!(!qt(e)&&typeof e!="number"||isNaN(+p(e)))}function Nt(e,t){const r=p(e,t?.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}function Rt(e,t){const r=p(e,t?.in);return Bt(r,Nt(r))+1}function _t(e,t){const r=p(e,t?.in),n=+F(r)-+Ht(r);return Math.round(n/et)+1}function nt(e,t){const r=p(e,t?.in),n=r.getFullYear(),a=I(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,i=O(t?.in||e,0);i.setFullYear(n+1,0,o),i.setHours(0,0,0,0);const f=v(i,t),g=O(t?.in||e,0);g.setFullYear(n,0,o),g.setHours(0,0,0,0);const y=v(g,t);return+r>=+f?n+1:+r>=+y?n:n-1}function Gt(e,t){const r=I(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=nt(e,t),o=O(t?.in||e,0);return o.setFullYear(a,0,n),o.setHours(0,0,0,0),v(o,t)}function Qt(e,t){const r=p(e,t?.in),n=+v(r,t)-+Gt(r,t);return Math.round(n/et)+1}function s(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const D={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return s(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):s(r+1,2)},d(e,t){return s(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return s(e.getHours()%12||12,t.length)},H(e,t){return s(e.getHours(),t.length)},m(e,t){return s(e.getMinutes(),t.length)},s(e,t){return s(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),a=Math.trunc(n*Math.pow(10,r-3));return s(a,t.length)}},M={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},z={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),a=n>0?n:1-n;return r.ordinalNumber(a,{unit:"year"})}return D.y(e,t)},Y:function(e,t,r,n){const a=nt(e,n),o=a>0?a:1-a;if(t==="YY"){const i=o%100;return s(i,2)}return t==="Yo"?r.ordinalNumber(o,{unit:"year"}):s(o,t.length)},R:function(e,t){const r=rt(e);return s(r,t.length)},u:function(e,t){const r=e.getFullYear();return s(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return s(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return s(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return D.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return s(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const a=Qt(e,n);return t==="wo"?r.ordinalNumber(a,{unit:"week"}):s(a,t.length)},I:function(e,t,r){const n=_t(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):s(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):D.d(e,t)},D:function(e,t,r){const n=Rt(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):s(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return s(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});case"eeee":default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return s(o,t.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});case"cccc":default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),a=n===0?7:n;switch(t){case"i":return String(a);case"ii":return s(a,t.length);case"io":return r.ordinalNumber(a,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let a;switch(n===12?a=M.noon:n===0?a=M.midnight:a=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let a;switch(n>=17?a=M.evening:n>=12?a=M.afternoon:n>=4?a=M.morning:a=M.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return D.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):D.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):s(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):s(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):D.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):D.s(e,t)},S:function(e,t){return D.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return Z(n);case"XXXX":case"XX":return k(n);case"XXXXX":case"XXX":default:return k(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return Z(n);case"xxxx":case"xx":return k(n);case"xxxxx":case"xxx":default:return k(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+U(n,":");case"OOOO":default:return"GMT"+k(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+U(n,":");case"zzzz":default:return"GMT"+k(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return s(n,t.length)},T:function(e,t,r){return s(+e,t.length)}};function U(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=Math.trunc(n/60),o=n%60;return o===0?r+String(a):r+String(a)+t+s(o,2)}function Z(e,t){return e%60===0?(e>0?"-":"+")+s(Math.abs(e)/60,2):k(e,t)}function k(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=s(Math.trunc(n/60),2),o=s(n%60,2);return r+a+t+o}const J=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},at=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},$t=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],a=r[2];if(!a)return J(e,t);let o;switch(n){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",J(n,t)).replace("{{time}}",at(a,t))},At={p:at,P:$t},Xt=/^D+$/,Vt=/^Y+$/,jt=["D","DD","YY","YYYY"];function zt(e){return Xt.test(e)}function Ut(e){return Vt.test(e)}function Zt(e,t,r){const n=Jt(e,t,r);if(console.warn(n),jt.includes(e))throw new RangeError(n)}function Jt(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Kt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,te=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ee=/^'([^]*?)'?$/,re=/''/g,ne=/[a-zA-Z]/;function K(e,t,r){const n=I(),a=r?.locale??n.locale??Ct,o=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,f=p(e,r?.in);if(!Lt(f))throw new RangeError("Invalid time value");let g=t.match(te).map(u=>{const d=u[0];if(d==="p"||d==="P"){const c=At[d];return c(u,a.formatLong)}return u}).join("").match(Kt).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:ae(u)};if(z[d])return{isToken:!0,value:u};if(d.match(ne))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});a.localize.preprocessor&&(g=a.localize.preprocessor(f,g));const y={firstWeekContainsDate:o,weekStartsOn:i,locale:a};return g.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!r?.useAdditionalWeekYearTokens&&Ut(d)||!r?.useAdditionalDayOfYearTokens&&zt(d))&&Zt(d,t,String(e));const c=z[d[0]];return c(f,d,a.localize,y)}).join("")}function ae(e){const t=e.match(ee);return t?t[1].replace(re,"'"):e}const B="YYYY/MM/DD";function H(e){return e.map(t=>new Date(t))}function oe(e){return e?e.map(t=>P(t).format(B)):[]}function se({disabled:e,element:t,widgetMgr:r,fragmentId:n}){const a=A(),o=h.useContext(ht),[i,f]=Mt({getStateFromWidgetMgr:ie,getDefaultStateFromProto:ce,getCurrStateFromProto:ue,updateWidgetMgrState:de,element:t,widgetMgr:r,fragmentId:n}),[g,y]=h.useState(!1),[u,d]=h.useState(null),{colors:c,fontSizes:q,fontWeights:it,lineHeights:Q,spacing:m,sizes:w}=A(),{locale:ct}=h.useContext(gt),C=Yt(ct),x=h.useMemo(()=>P(t.min,B).toDate(),[t.min]),S=h.useMemo(()=>st(t),[t]),ut=h.useMemo(()=>{if(!t.isRange)return!1;const l=P().subtract(2,"years").toDate();return x<l},[t.isRange,x]),dt=t.default.length===0&&!e,L=h.useMemo(()=>t.format.replaceAll(/[a-zA-Z]/g,"9"),[t.format]),Y=h.useMemo(()=>t.format.replaceAll("Y","y").replaceAll("D","d"),[t.format]),N=h.useMemo(()=>K(x,Y,{locale:C}),[x,Y,C]),R=h.useMemo(()=>S?K(S,Y,{locale:C}):"",[S,Y,C]),$=h.useCallback(l=>{if(!l)return null;if(t.isRange){const b=l==="End"?`before ${R}`:`after ${N}`;return`**Error**: ${l} date set outside allowed range. Please select a date ${b}.`}return`**Error**: Date set outside allowed range. Please select a date between ${N} and ${R}.`},[t.isRange,R,N]),ft=h.useCallback(({date:l})=>{if(d(null),tt(l)){f({value:[],fromUi:!0}),y(!0);return}const b=Array.isArray(l)?l.filter(_=>!!_).map(_=>G(_)):G(l),{errorType:W,newDates:E}=ot(b,x,S);W&&d($(W)),f({value:E,fromUi:!0}),y(!E)},[f,$,d,x,S]),lt=h.useCallback(()=>{if(!g)return;const l=H(t.default);f({value:l,fromUi:!0}),y(!l)},[g,t,f]);return mt("div",{className:"stDateInput","data-testid":"stDateInput",children:[T(pt,{label:t.label,disabled:e,labelVisibility:wt(t.labelVisibility?.value),children:t.help&&T(bt,{content:t.help,label:t.label})}),T(Et,{locale:C,density:Wt.high,formatString:Y,mask:t.isRange?`${L} – ${L}`:L,placeholder:t.isRange?`${t.format} – ${t.format}`:t.format,disabled:e,onChange:ft,onClose:lt,quickSelect:ut,overrides:{Popover:{props:{ignoreBoundary:o,placement:yt.bottomLeft,overrides:{Body:{style:{marginTop:m.px}}}}},CalendarContainer:{style:{fontSize:q.sm,paddingRight:m.sm,paddingLeft:m.sm,paddingBottom:m.sm,paddingTop:m.sm}},Week:{style:{fontSize:q.sm}},Day:{style:({$pseudoHighlighted:l,$pseudoSelected:b,$selected:W,$isHovered:E})=>({fontSize:q.sm,lineHeight:Q.base,"::before":{backgroundColor:W||b||l||E?`${c.darkenedBgMix15} !important`:c.transparent},"::after":{borderColor:c.transparent},...Tt(a)&&E&&b&&!W?{color:c.secondaryBg}:{}})},PrevButton:{style:()=>({display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:c.transparent},":focus":{backgroundColor:c.transparent,outline:0}})},NextButton:{style:{display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:c.transparent},":focus":{backgroundColor:c.transparent,outline:0}}},Input:{props:{maskChar:null,endEnhancer:u&&T(Ot,{content:T(St,{source:u,allowHTML:!1}),placement:xt.TOP_RIGHT,error:!0,children:T(kt,{content:Pt,size:"lg"})}),overrides:{EndEnhancer:{style:{color:c.redTextColor,backgroundColor:c.transparent}},Root:{style:({$isFocused:l})=>{const b=Dt(c,l);return{borderLeftWidth:w.borderWidth,borderRightWidth:w.borderWidth,borderTopWidth:w.borderWidth,borderBottomWidth:w.borderWidth,paddingRight:m.twoXS,borderTopColor:b,borderRightColor:b,borderBottomColor:b,borderLeftColor:b,...u&&{backgroundColor:c.redBackgroundColor}}}},ClearIcon:{props:{overrides:{Svg:{style:{color:c.grayTextColor,padding:m.threeXS,height:w.clearIconSize,width:w.clearIconSize,":hover":{fill:c.bodyText}}}}}},InputContainer:{style:{backgroundColor:"transparent"}},Input:{style:{fontWeight:it.normal,paddingRight:m.sm,paddingLeft:m.md,paddingBottom:m.sm,paddingTop:m.sm,lineHeight:Q.inputWidget,"::placeholder":{color:c.fadedText60},...u&&{color:c.redTextColor}},props:{"data-testid":"stDateInputField"}}}}},QuickSelect:{props:{overrides:{ControlContainer:{style:{height:w.minElementHeight,borderLeftWidth:w.borderWidth,borderRightWidth:w.borderWidth,borderTopWidth:w.borderWidth,borderBottomWidth:w.borderWidth}}}}}},value:i,minDate:x,maxDate:S,range:t.isRange,clearable:dt})]})}function ie(e,t){const r=e.getStringArrayValue(t),n=r!==void 0?r:t.default||[];return H(n)}function ce(e){return H(e.default)??[]}function ue(e){return H(e.value)??[]}function de(e,t,r,n){const a=P(e.min,B).toDate(),o=st(e);let i=!0;const f=(r.value||[]).map(y=>G(y)),{errorType:g}=ot(f,a,o);g&&(i=!1),i&&t.setStringArrayValue(e,oe(r.value),{fromUi:r.fromUi},n)}function ot(e,t,r){const n=[];let a=null;return tt(e)?{errorType:null,newDates:[]}:(Array.isArray(e)?e.forEach(o=>{o&&(r&&o>r?a="End":o<t&&(a="Start"),n.push(o))}):e&&(r&&e>r?a="End":e<t&&(a="Start"),n.push(e)),{errorType:a,newDates:n})}function st(e){const t=e.max;return t&&t.length>0?P(t,B).toDate():void 0}function G(e){const t=new Date(e.getTime());return t.setHours(0,0,0,0),t}const De=h.memo(se);export{De as default};
1
+ import{r as h,l as $,aB as ht,L as gt,e as tt,o as mt,j as T,p as wt,ad as bt,ae as pt,ay as yt,ag as Dt,aA as Ot,P as xt,az as kt,q as St,m as Tt}from"./index.BHyzKS4e.js";import{h as P}from"./moment.C7qA8nIE.js";import{u as Mt}from"./useBasicWidgetState.BXKaD8DQ.js";import{e as Ct,u as Yt,D as Wt,a as Et}from"./useIntlLocale.CysOvegI.js";import{E as Pt}from"./ErrorOutline.esm.C9uHPmIj.js";import"./FormClearHelper.DQoXcOWo.js";import"./timepicker.Bd34xjcG.js";import"./input.BCHJn1Cw.js";import"./base-input.iB32RS3w.js";const et=6048e5,vt=864e5,X=Symbol.for("constructDateFrom");function O(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&X in e?e[X](t):e instanceof Date?new e.constructor(t):new Date(t)}function p(e,t){return O(t||e,e)}let Ft={};function I(){return Ft}function v(e,t){const r=I(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=p(e,t?.in),o=a.getDay(),i=(o<n?7:0)+o-n;return a.setDate(a.getDate()-i),a.setHours(0,0,0,0),a}function F(e,t){return v(e,{...t,weekStartsOn:1})}function rt(e,t){const r=p(e,t?.in),n=r.getFullYear(),a=O(r,0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);const o=F(a),i=O(r,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const f=F(i);return r.getTime()>=o.getTime()?n+1:r.getTime()>=f.getTime()?n:n-1}function V(e){const t=p(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function It(e,...t){const r=O.bind(null,t.find(n=>typeof n=="object"));return t.map(r)}function j(e,t){const r=p(e,t?.in);return r.setHours(0,0,0,0),r}function Bt(e,t,r){const[n,a]=It(r?.in,e,t),o=j(n),i=j(a),f=+o-V(o),g=+i-V(i);return Math.round((f-g)/vt)}function Ht(e,t){const r=rt(e,t),n=O(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),F(n)}function qt(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Lt(e){return!(!qt(e)&&typeof e!="number"||isNaN(+p(e)))}function Nt(e,t){const r=p(e,t?.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}function Rt(e,t){const r=p(e,t?.in);return Bt(r,Nt(r))+1}function _t(e,t){const r=p(e,t?.in),n=+F(r)-+Ht(r);return Math.round(n/et)+1}function nt(e,t){const r=p(e,t?.in),n=r.getFullYear(),a=I(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,i=O(t?.in||e,0);i.setFullYear(n+1,0,o),i.setHours(0,0,0,0);const f=v(i,t),g=O(t?.in||e,0);g.setFullYear(n,0,o),g.setHours(0,0,0,0);const y=v(g,t);return+r>=+f?n+1:+r>=+y?n:n-1}function Gt(e,t){const r=I(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=nt(e,t),o=O(t?.in||e,0);return o.setFullYear(a,0,n),o.setHours(0,0,0,0),v(o,t)}function Qt(e,t){const r=p(e,t?.in),n=+v(r,t)-+Gt(r,t);return Math.round(n/et)+1}function s(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const D={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return s(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):s(r+1,2)},d(e,t){return s(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return s(e.getHours()%12||12,t.length)},H(e,t){return s(e.getHours(),t.length)},m(e,t){return s(e.getMinutes(),t.length)},s(e,t){return s(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),a=Math.trunc(n*Math.pow(10,r-3));return s(a,t.length)}},M={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},z={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),a=n>0?n:1-n;return r.ordinalNumber(a,{unit:"year"})}return D.y(e,t)},Y:function(e,t,r,n){const a=nt(e,n),o=a>0?a:1-a;if(t==="YY"){const i=o%100;return s(i,2)}return t==="Yo"?r.ordinalNumber(o,{unit:"year"}):s(o,t.length)},R:function(e,t){const r=rt(e);return s(r,t.length)},u:function(e,t){const r=e.getFullYear();return s(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return s(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return s(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return D.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return s(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const a=Qt(e,n);return t==="wo"?r.ordinalNumber(a,{unit:"week"}):s(a,t.length)},I:function(e,t,r){const n=_t(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):s(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):D.d(e,t)},D:function(e,t,r){const n=Rt(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):s(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return s(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});case"eeee":default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return s(o,t.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});case"cccc":default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),a=n===0?7:n;switch(t){case"i":return String(a);case"ii":return s(a,t.length);case"io":return r.ordinalNumber(a,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let a;switch(n===12?a=M.noon:n===0?a=M.midnight:a=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let a;switch(n>=17?a=M.evening:n>=12?a=M.afternoon:n>=4?a=M.morning:a=M.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return D.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):D.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):s(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):s(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):D.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):D.s(e,t)},S:function(e,t){return D.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return Z(n);case"XXXX":case"XX":return k(n);case"XXXXX":case"XXX":default:return k(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return Z(n);case"xxxx":case"xx":return k(n);case"xxxxx":case"xxx":default:return k(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+U(n,":");case"OOOO":default:return"GMT"+k(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+U(n,":");case"zzzz":default:return"GMT"+k(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return s(n,t.length)},T:function(e,t,r){return s(+e,t.length)}};function U(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=Math.trunc(n/60),o=n%60;return o===0?r+String(a):r+String(a)+t+s(o,2)}function Z(e,t){return e%60===0?(e>0?"-":"+")+s(Math.abs(e)/60,2):k(e,t)}function k(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=s(Math.trunc(n/60),2),o=s(n%60,2);return r+a+t+o}const J=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},at=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},At=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],a=r[2];if(!a)return J(e,t);let o;switch(n){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",J(n,t)).replace("{{time}}",at(a,t))},$t={p:at,P:At},Xt=/^D+$/,Vt=/^Y+$/,jt=["D","DD","YY","YYYY"];function zt(e){return Xt.test(e)}function Ut(e){return Vt.test(e)}function Zt(e,t,r){const n=Jt(e,t,r);if(console.warn(n),jt.includes(e))throw new RangeError(n)}function Jt(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Kt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,te=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ee=/^'([^]*?)'?$/,re=/''/g,ne=/[a-zA-Z]/;function K(e,t,r){const n=I(),a=r?.locale??n.locale??Ct,o=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,f=p(e,r?.in);if(!Lt(f))throw new RangeError("Invalid time value");let g=t.match(te).map(u=>{const d=u[0];if(d==="p"||d==="P"){const c=$t[d];return c(u,a.formatLong)}return u}).join("").match(Kt).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:ae(u)};if(z[d])return{isToken:!0,value:u};if(d.match(ne))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});a.localize.preprocessor&&(g=a.localize.preprocessor(f,g));const y={firstWeekContainsDate:o,weekStartsOn:i,locale:a};return g.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!r?.useAdditionalWeekYearTokens&&Ut(d)||!r?.useAdditionalDayOfYearTokens&&zt(d))&&Zt(d,t,String(e));const c=z[d[0]];return c(f,d,a.localize,y)}).join("")}function ae(e){const t=e.match(ee);return t?t[1].replace(re,"'"):e}const B="YYYY/MM/DD";function H(e){return e.map(t=>new Date(t))}function oe(e){return e?e.map(t=>P(t).format(B)):[]}function se({disabled:e,element:t,widgetMgr:r,fragmentId:n}){const a=$(),o=h.useContext(ht),[i,f]=Mt({getStateFromWidgetMgr:ie,getDefaultStateFromProto:ce,getCurrStateFromProto:ue,updateWidgetMgrState:de,element:t,widgetMgr:r,fragmentId:n}),[g,y]=h.useState(!1),[u,d]=h.useState(null),{colors:c,fontSizes:q,fontWeights:it,lineHeights:Q,spacing:m,sizes:w}=$(),{locale:ct}=h.useContext(gt),C=Yt(ct),x=h.useMemo(()=>P(t.min,B).toDate(),[t.min]),S=h.useMemo(()=>st(t),[t]),ut=h.useMemo(()=>{if(!t.isRange)return!1;const l=P().subtract(2,"years").toDate();return x<l},[t.isRange,x]),dt=t.default.length===0&&!e,L=h.useMemo(()=>t.format.replaceAll(/[a-zA-Z]/g,"9"),[t.format]),Y=h.useMemo(()=>t.format.replaceAll("Y","y").replaceAll("D","d"),[t.format]),N=h.useMemo(()=>K(x,Y,{locale:C}),[x,Y,C]),R=h.useMemo(()=>S?K(S,Y,{locale:C}):"",[S,Y,C]),A=h.useCallback(l=>{if(!l)return null;if(t.isRange){const b=l==="End"?`before ${R}`:`after ${N}`;return`**Error**: ${l} date set outside allowed range. Please select a date ${b}.`}return`**Error**: Date set outside allowed range. Please select a date between ${N} and ${R}.`},[t.isRange,R,N]),ft=h.useCallback(({date:l})=>{if(d(null),tt(l)){f({value:[],fromUi:!0}),y(!0);return}const b=Array.isArray(l)?l.filter(_=>!!_).map(_=>G(_)):G(l),{errorType:W,newDates:E}=ot(b,x,S);W&&d(A(W)),f({value:E,fromUi:!0}),y(!E)},[f,A,d,x,S]),lt=h.useCallback(()=>{if(!g)return;const l=H(t.default);f({value:l,fromUi:!0}),y(!l)},[g,t,f]);return mt("div",{className:"stDateInput","data-testid":"stDateInput",children:[T(pt,{label:t.label,disabled:e,labelVisibility:wt(t.labelVisibility?.value),children:t.help&&T(bt,{content:t.help,label:t.label})}),T(Et,{locale:C,density:Wt.high,formatString:Y,mask:t.isRange?`${L} – ${L}`:L,placeholder:t.isRange?`${t.format} – ${t.format}`:t.format,disabled:e,onChange:ft,onClose:lt,quickSelect:ut,overrides:{Popover:{props:{ignoreBoundary:o,placement:yt.bottomLeft,overrides:{Body:{style:{marginTop:m.px}}}}},CalendarContainer:{style:{fontSize:q.sm,paddingRight:m.sm,paddingLeft:m.sm,paddingBottom:m.sm,paddingTop:m.sm}},Week:{style:{fontSize:q.sm}},Day:{style:({$pseudoHighlighted:l,$pseudoSelected:b,$selected:W,$isHovered:E})=>({fontSize:q.sm,lineHeight:Q.base,"::before":{backgroundColor:W||b||l||E?`${c.darkenedBgMix15} !important`:c.transparent},"::after":{borderColor:c.transparent},...Tt(a)&&E&&b&&!W?{color:c.secondaryBg}:{}})},PrevButton:{style:()=>({display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:c.transparent},":focus":{backgroundColor:c.transparent,outline:0}})},NextButton:{style:{display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:c.transparent},":focus":{backgroundColor:c.transparent,outline:0}}},Input:{props:{maskChar:null,endEnhancer:u&&T(Ot,{content:T(St,{source:u,allowHTML:!1}),placement:xt.TOP_RIGHT,error:!0,children:T(kt,{content:Pt,size:"lg"})}),overrides:{EndEnhancer:{style:{color:c.redTextColor,backgroundColor:c.transparent}},Root:{style:({$isFocused:l})=>{const b=Dt(c,l);return{borderLeftWidth:w.borderWidth,borderRightWidth:w.borderWidth,borderTopWidth:w.borderWidth,borderBottomWidth:w.borderWidth,paddingRight:m.twoXS,borderTopColor:b,borderRightColor:b,borderBottomColor:b,borderLeftColor:b,...u&&{backgroundColor:c.redBackgroundColor}}}},ClearIcon:{props:{overrides:{Svg:{style:{color:c.grayTextColor,padding:m.threeXS,height:w.clearIconSize,width:w.clearIconSize,":hover":{fill:c.bodyText}}}}}},InputContainer:{style:{backgroundColor:"transparent"}},Input:{style:{fontWeight:it.normal,paddingRight:m.sm,paddingLeft:m.md,paddingBottom:m.sm,paddingTop:m.sm,lineHeight:Q.inputWidget,"::placeholder":{color:c.fadedText60},...u&&{color:c.redTextColor}},props:{"data-testid":"stDateInputField"}}}}},QuickSelect:{props:{overrides:{ControlContainer:{style:{height:w.minElementHeight,borderLeftWidth:w.borderWidth,borderRightWidth:w.borderWidth,borderTopWidth:w.borderWidth,borderBottomWidth:w.borderWidth}}}}}},value:i,minDate:x,maxDate:S,range:t.isRange,clearable:dt})]})}function ie(e,t){const r=e.getStringArrayValue(t),n=r!==void 0?r:t.default||[];return H(n)}function ce(e){return H(e.default)??[]}function ue(e){return H(e.value)??[]}function de(e,t,r,n){const a=P(e.min,B).toDate(),o=st(e);let i=!0;const f=(r.value||[]).map(y=>G(y)),{errorType:g}=ot(f,a,o);g&&(i=!1),i&&t.setStringArrayValue(e,oe(r.value),{fromUi:r.fromUi},n)}function ot(e,t,r){const n=[];let a=null;return tt(e)?{errorType:null,newDates:[]}:(Array.isArray(e)?e.forEach(o=>{o&&(r&&o>r?a="End":o<t&&(a="Start"),n.push(o))}):e&&(r&&e>r?a="End":e<t&&(a="Start"),n.push(e)),{errorType:a,newDates:n})}function st(e){const t=e.max;return t&&t.length>0?P(t,B).toDate():void 0}function G(e){const t=new Date(e.getTime());return t.setHours(0,0,0,0),t}const De=h.memo(se);export{De as default};
@@ -0,0 +1 @@
1
+ import{r as a,E as G,_ as Y,z as V,bk as C,e as h,n as J,V as dt,l as pt,k as ft,ab as mt,ac as k,o as B,j as d,p as bt,ad as ht,ae as gt,af as yt,Y as It,az as j}from"./index.BHyzKS4e.js";import{I as Ct}from"./InputInstructions.C7VMyGT7.js";import{u as Tt}from"./useBasicWidgetState.BXKaD8DQ.js";import{s as St}from"./sprintfjs.CtrdaGLQ.js";import{u as wt}from"./uniqueId.Bd_Iuzvc.js";import{I as vt}from"./input.BCHJn1Cw.js";import"./FormClearHelper.DQoXcOWo.js";import"./base-input.iB32RS3w.js";var Q=a.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(G,Y({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),a.createElement("path",{d:"M0 3v2h8V3H0z"}))});Q.displayName="Minus";var Z=a.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(G,Y({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),a.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});Z.displayName="Plus";const xt=V("div",{target:"eaeic2i0"})(({theme:t})=>({display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:t.sizes.minElementHeight,borderWidth:t.sizes.borderWidth,borderStyle:"solid",borderColor:t.colors.widgetBorderColor??t.colors.secondaryBg,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:t.radii.default,overflow:"hidden","&.focused":{borderColor:t.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:t.spacing.none}}})),Dt=V("div",{target:"eaeic2i1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),K=V("button",{target:"eaeic2i2"})(({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"},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}})),kt=V("div",{target:"eaeic2i3"})(({theme:t,clearable:e})=>({position:"absolute",marginRight:t.spacing.twoXS,left:0,right:`calc(${t.sizes.numberInputControlsWidth} * 2 + ${e?"1em":"0em"})`})),Vt=dt.getLogger("NumberInput");function Nt(t){return h(t)||t===""?void 0:t}const tt=t=>{const e=t.toString();if(e.includes("e-")){const o=e.match(/(\d+(?:\.\d+)?)e-(\d+)/);if(o){const i=(o[1]?.split(".")[1]||"").length,n=parseInt(o[2],10);return i+n}return 0}return(e.split(".")[1]||"").length},_=({value:t,format:e,step:o,dataType:i})=>{if(h(t))return null;let n=Nt(e);if(h(n)&&J(o)&&i===C.DataType.FLOAT&&o!==0){const l=tt(o);l>0&&(n=`%0.${l}f`)}if(h(n))return t.toString();try{return St(n,t)}catch(l){return Vt.warn(`Error in sprintf(${n}, ${t}): ${l}`),String(t)}},Et=(t,e,o)=>h(t)?!1:t-e>=o,Rt=(t,e,o)=>h(t)?!1:t+e<=o,X=(t,e,o)=>{const i=tt(e);if(i===0)switch(o){case"add":return t+e;case"subtract":return t-e}const n=Math.pow(10,i),l=Math.round(t*n),p=Math.round(e*n);switch(o){case"add":return(l+p)/n;case"subtract":return(l-p)/n}},Ft=({step:t,dataType:e})=>t||(e===C.DataType.INT?1:.01);function q(t,e){return e.dataType===C.DataType.INT?t.getIntValue(e):t.getDoubleValue(e)}function Wt(t){return t.default??null}function zt(t){return t.value??t.default??null}function Bt(t,e,o,i){switch(t.dataType){case C.DataType.INT:e.setIntValue(t,o.value,{fromUi:o.fromUi},i);break;case C.DataType.FLOAT:e.setDoubleValue(t,o.value,{fromUi:o.fromUi},i);break;default:throw new Error("Invalid data type")}}const Lt=({disabled:t,element:e,widgetMgr:o,fragmentId:i})=>{const n=pt(),{dataType:l,formId:p,default:T,format:N,icon:E,min:g,max:y}=e,{width:L,elementRef:et}=ft(),c=a.useMemo(()=>Ft({step:e.step,dataType:e.dataType}),[e.step,e.dataType]),I=a.useCallback(r=>_({value:r,dataType:l,format:N,step:c}),[l,N,c]),[f,w]=a.useState(!1),[b,S]=a.useState(()=>{const r=q(o,e)??T??null;return _({value:r,dataType:l,format:N,step:c})}),[P,U]=Tt({getStateFromWidgetMgr:q,getDefaultStateFromProto:Wt,getCurrStateFromProto:zt,updateWidgetMgrState:Bt,element:e,widgetMgr:o,fragmentId:i,onFormCleared:a.useCallback(()=>{const r=T??null;w(!1),S(I(r))},[T,I])}),[A,H]=a.useState(!1),R=a.useRef(null),[$]=a.useState(()=>wt("number_input_")),M=mt({formId:p}),nt=M?o.allowFormEnterToSubmit(p):f,ot=A&&L>k(n.breakpoints.hideWidgetDetails);a.useEffect(()=>{f||S(I(P))},[P,f,I]);const m=a.useCallback(({value:r,fromUi:s})=>{if(J(r)&&(g>r||r>y)){R.current?.reportValidity();return}const D=r??T??null;U({value:D,fromUi:s}),w(!1),S(I(D))},[g,y,T,I,U]),rt=a.useCallback(()=>{H(!0)},[]);a.useEffect(()=>{const r=R.current;if(r){const s=D=>{D.preventDefault()};return r.addEventListener("wheel",s),()=>{r.removeEventListener("wheel",s)}}},[]);const F=h(e.default)&&!t,at=a.useCallback(r=>{const{value:s}=r.target;s===""?(w(!0),S(null)):(w(!0),S(s))},[]),u=a.useMemo(()=>{if(b===null||b==="")return null;if(e.dataType===C.DataType.INT){const s=parseInt(b,10);return isNaN(s)?null:s}const r=parseFloat(b);return isNaN(r)?null:r},[b,e.dataType]),v=Et(u,c,g),x=Rt(u,c,y),it=a.useCallback(()=>{f&&m({value:u,fromUi:!0}),H(!1)},[f,u,m]),W=a.useCallback(()=>{if(x){const r=X(u??g,c,"add");m({value:r,fromUi:!0})}},[u,g,c,x,m]),z=a.useCallback(()=>{if(v){const r=X(u??y,c,"subtract");m({value:r,fromUi:!0})}},[u,y,c,v,m]),st=a.useCallback(r=>{const{key:s}=r;switch(s){case"ArrowUp":r.preventDefault(),W();break;case"ArrowDown":r.preventDefault(),z();break}},[W,z]),lt=a.useCallback(r=>{r.key==="Enter"&&(f&&m({value:u,fromUi:!0}),o.allowFormEnterToSubmit(p)&&o.submitForm(p,i))},[f,u,m,o,p,i]),ct=k(n.iconSizes.lg)+2*k(n.spacing.twoXS),O=k(n.breakpoints.hideNumberInputControls),ut=E?O+ct:O;return B("div",{className:"stNumberInput","data-testid":"stNumberInput",ref:et,children:[d(gt,{label:e.label,disabled:t,labelVisibility:bt(e.labelVisibility?.value),htmlFor:$,children:e.help&&d(ht,{content:e.help,label:e.label})}),B(xt,{className:A?"focused":"","data-testid":"stNumberInputContainer",children:[d(vt,{type:"number",inputRef:R,value:b??"",placeholder:e.placeholder,onBlur:it,onFocus:rt,onChange:at,onKeyPress:lt,onKeyDown:st,clearable:F,clearOnEscape:F,disabled:t,"aria-label":e.label,startEnhancer:e.icon&&d(It,{"data-testid":"stNumberInputIcon",iconValue:e.icon,size:"lg"}),id:$,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:n.colors.grayTextColor,padding:n.spacing.threeXS,height:n.sizes.clearIconSize,width:n.sizes.clearIconSize,":hover":{fill:n.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:c,min:g,max:y,type:"number",inputMode:""},style:{fontWeight:n.fontWeights.normal,lineHeight:n.lineHeights.inputWidget,paddingRight:n.spacing.sm,paddingLeft:n.spacing.md,paddingBottom:n.spacing.sm,paddingTop:n.spacing.sm,"::placeholder":{color:n.colors.fadedText60}}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingRight:0,paddingLeft:E?n.spacing.sm:0}},StartEnhancer:{style:{paddingLeft:0,paddingRight:0,minWidth:n.iconSizes.lg,color:yt(E)?n.colors.fadedText60:"inherit"}}}}),L>ut&&B(Dt,{children:[d(K,{"data-testid":"stNumberInputStepDown",onClick:z,disabled:!v||t,tabIndex:-1,children:d(j,{content:Q,size:"xs",color:v?"inherit":n.colors.fadedText40})}),d(K,{"data-testid":"stNumberInputStepUp",onClick:W,disabled:!x||t,tabIndex:-1,children:d(j,{content:Z,size:"xs",color:x?"inherit":n.colors.fadedText40})})]})]}),ot&&d(kt,{clearable:F,children:d(Ct,{dirty:f,value:b??"",inForm:M,allowEnterToSubmit:nt})})]})},Kt=a.memo(Lt);export{Kt as default};
@@ -1 +1 @@
1
- import{r as t,E as L,_ as D,L as ze,e as ue,n as F,aL as se,bY as Le,bS as De,bR as Be,z as p,j as n,Y as Ve,o as x,B as We,ax as Me,b as Ne,l as Oe,aa as He,p as $e,ab as je,P as _e,ac as Xe}from"./index.CPc_uZux.js";import{u as Ge}from"./useWaveformController.B0olyXLQ.js";import{T as qe,a as ce}from"./Toolbar.COH7NaOE.js";import{u as Ye,F as Ke}from"./FormClearHelper.DTFnX0js.js";import{c as Je}from"./createDownloadLinkElement.6oO-YlYv.js";import{E as Qe}from"./urls.BwSlolu9.js";import{F as Ze,D as et}from"./FileDownload.esm.Z9hRQIHi.js";var fe=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.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"}),t.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"}))});fe.displayName="Mic";var pe=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.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"}))});pe.displayName="Pause";var me=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.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"}))});me.displayName="PlayArrow";var ge=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),t.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"}))});ge.displayName="Refresh";var he=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.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"}))});he.displayName="StopCircle";const tt=(e,r)=>{const{enforceDownloadInNewTab:o=!1}=t.useContext(ze);return t.useCallback(()=>{if(!e)return;const l=Je({enforceDownloadInNewTab:o,url:e,filename:r});l.style.display="none",document.body.appendChild(l),l.click(),document.body.removeChild(l)},[e,o,r])},j=({widgetMgr:e,id:r,formId:o,key:i,defaultValue:l})=>{t.useEffect(()=>{const s=e.getElementState(r,i);ue(s)&&F(l)&&e.setElementState(r,i,l)},[e,r,i,l]);const[R,g]=t.useState(e.getElementState(r,i)??l),c=t.useCallback(s=>{e.setElementState(r,i,s),g(s)},[e,r,i]),v=t.useMemo(()=>({formId:o||""}),[o]),E=t.useCallback(()=>c(l),[l,c]);return Ye({element:v,widgetMgr:e,onFormCleared:E}),[R,c]},rt=async({files:e,uploadClient:r,widgetMgr:o,widgetInfo:i,fragmentId:l,signal:R})=>{let g=[];try{g=await r.fetchFileURLs(e)}catch(s){return{successfulUploads:[],failedUploads:e.map(d=>({file:d,error:se(s)}))}}const c=Le(e,g),v=[],E=[];return await Promise.all(c.map(async([s,d])=>{if(!s||!d?.uploadUrl||!d.fileId)return{file:s,fileUrl:d,error:new Error("No upload URL found")};try{await r.uploadFile({id:d.fileId,formId:i.formId||""},d.uploadUrl,s,void 0,R),v.push({fileUrl:d,file:s})}catch(h){const O=se(h);E.push({file:s,error:O})}})),o.setFileUploaderStateValue(i,new De({uploadedFileInfo:v.map(({file:s,fileUrl:d})=>new Be({fileId:d.fileId,fileUrls:d,name:s.webkitRelativePath||s.name,size:s.size}))}),{fromUi:!0},l),{successfulUploads:v,failedUploads:E}},ot=p("div",{target:"e18uw4vz0"})(),de=p("div",{target:"e18uw4vz1"})(({theme:e,disabled:r})=>({height:e.sizes.largestElementHeight,width:"100%",background:e.colors.secondaryBg,borderRadius:e.radii.default,marginBottom:e.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:e.spacing.xs,paddingRight:e.spacing.sm,border:e.colors.widgetBorderColor?`${e.sizes.borderWidth} solid ${e.colors.widgetBorderColor}`:void 0,cursor:r?"not-allowed":"auto",overflow:"hidden"})),nt=p("div",{target:"e18uw4vz2"})({flex:1}),at=p("div",{target:"e18uw4vz3"})(({show:e,theme:r})=>({display:e?"block":"none",position:"relative",height:r.sizes.largestElementHeight,"& > div":{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center"}})),lt=p("span",{target:"e18uw4vz4"})(({theme:e,isPlayingOrRecording:r,disabled:o})=>({margin:e.spacing.sm,fontFamily:e.fonts.monospace,color:o?e.colors.fadedText40:r?e.colors.bodyText:e.colors.fadedText60,backgroundColor:e.colors.secondaryBg,fontSize:e.fontSizes.sm})),be=p("div",{target:"e18uw4vz5"})({width:"100%",textAlign:"center",overflow:"hidden"}),ve=p("span",{target:"e18uw4vz6"})(({theme:e})=>({color:e.colors.bodyText})),it=p("a",{target:"e18uw4vz7"})(({theme:e})=>({color:e.colors.link,textDecoration:e.linkUnderline?"underline":"none"})),st=p("div",{target:"e18uw4vz8"})(({theme:e})=>({flex:1,height:e.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"})),ct=p("div",{target:"e18uw4vz9"})(({theme:e})=>{const r="0.625em";return{opacity:.2,width:"100%",height:r,backgroundSize:r,backgroundImage:`radial-gradient(${e.colors.fadedText10} 40%, transparent 40%)`,backgroundRepeat:"repeat"}}),dt=p("span",{target:"e18uw4vz10"})(({theme:e})=>({"& > button":{color:e.colors.primary,padding:e.spacing.threeXS},"& > button:hover, & > button:focus":{color:e.colors.redColor}})),ut=p("span",{target:"e18uw4vz11"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}})),ye=p("span",{target:"e18uw4vz12"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}})),_=p("div",{target:"e18uw4vz13"})(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:e.spacing.xs,gap:e.spacing.twoXS,marginRight:e.spacing.twoXS})),z=({onClick:e,disabled:r,ariaLabel:o,iconContent:i})=>n(Ne,{kind:We.BORDERLESS_ICON,onClick:e,disabled:r,"aria-label":o,containerWidth:!0,"data-testid":"stAudioInputActionButton",children:n(Me,{content:i,size:"lg",color:"inherit"})}),ft=({disabled:e,stopRecording:r})=>n(dt,{children:n(z,{onClick:r,disabled:e,ariaLabel:"Stop recording",iconContent:he})}),pt=({disabled:e,isPlaying:r,onClickPlayPause:o})=>n(ye,{children:r?n(z,{onClick:o,disabled:e,ariaLabel:"Pause",iconContent:pe}):n(z,{onClick:o,disabled:e,ariaLabel:"Play",iconContent:me})}),mt=({disabled:e,startRecording:r})=>n(ut,{children:n(z,{onClick:r,disabled:e,ariaLabel:"Record",iconContent:fe})}),gt=({onClick:e})=>n(ye,{children:n(z,{disabled:!1,onClick:e,ariaLabel:"Reset",iconContent:ge})}),ht=({disabled:e,isRecording:r,isPlaying:o,isUploading:i,isError:l,recordingUrlExists:R,startRecording:g,stopRecording:c,onClickPlayPause:v,onClear:E})=>l?n(_,{children:n(gt,{onClick:E})}):i?n(_,{children:n(Ve,{size:"base",iconValue:"spinner"})}):x(_,{children:[r?n(ft,{disabled:e,stopRecording:c}):n(mt,{disabled:e,startRecording:g}),R&&n(pt,{disabled:e,isPlaying:o,onClickPlayPause:v})]}),bt=t.memo(ht),vt=()=>n(be,{children:n(ve,{children:"An error has occurred, please try again."})}),yt=t.memo(vt),C="00:00",A=e=>{const r=Math.floor(e/1e3),o=Math.floor(r/60),i=Math.floor(o/60),l=r%60,R=o%60,g=l.toString().padStart(2,"0"),c=R.toString().padStart(2,"0"),v=i.toString().padStart(2,"0");return o<60?`${c}:${g}`:`${v}:${c}:${g}`},wt=()=>x(be,{children:[n(ve,{children:"This app would like to use your microphone."})," ",n(it,{href:Qe,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]}),St=t.memo(wt),Ct=()=>n(st,{children:n(ct,{})}),Rt=t.memo(Ct),Et=({element:e,uploadClient:r,widgetMgr:o,fragmentId:i,disabled:l})=>{const R=Oe(),g=t.useRef(null),[c,v]=t.useState(!1),[E,s]=t.useState(!1),[d,h]=t.useState(!1),[O,b]=t.useState(C),[B,V]=j({widgetMgr:o,id:e.id,key:"deleteFileUrl",defaultValue:null}),[m,W]=j({widgetMgr:o,id:e.id,key:"recordingUrl",defaultValue:null}),[H,I]=j({widgetMgr:o,id:e.id,formId:e.formId,key:"recordingTime",defaultValue:C}),U=t.useRef(null),w=t.useRef(null),u=t.useRef(null),X=e.id,S=e.formId,we=t.useCallback(async a=>{U.current&&U.current.abort();const y=new AbortController;U.current=y;try{if(s(!0),F(S)&&o.setFormsWithUploadsInProgress(new Set([S])),y.signal.aborted)return;let f;try{f=URL.createObjectURL(a),w.current&&w.current!==f&&URL.revokeObjectURL(w.current),w.current=f}catch{h(!0),s(!1),F(S)&&o.setFormsWithUploadsInProgress(new Set);return}if(y.signal.aborted){URL.revokeObjectURL(f),w.current=null;return}W(f);const Pe=new Date().toISOString().slice(0,16).replace(/:/g,"-"),Fe=new File([a],`${Pe}_audio.wav`,{type:a.type});try{const{successfulUploads:xe,failedUploads:Te}=await rt({files:[Fe],uploadClient:r,widgetMgr:o,widgetInfo:{id:X,formId:S},fragmentId:i,signal:y.signal});if(y.signal.aborted)return;if(Te.length>0){h(!0);return}h(!1);const ie=xe[0];ie?.fileUrl?.deleteUrl&&V(ie.fileUrl.deleteUrl)}catch{y.signal.aborted||h(!0)}finally{F(S)&&o.setFormsWithUploadsInProgress(new Set),y.signal.aborted||s(!1)}}catch{y.signal.aborted||(h(!0),s(!1)),F(S)&&o.setFormsWithUploadsInProgress(new Set)}},[r,o,X,S,i,V,W]),M=t.useRef(null),G=Ge({containerRef:g,sampleRate:e.sampleRate??void 0,waveformPadding:He(R.spacing.twoXS),events:{onPermissionDenied:()=>{v(!0)},onError:()=>{h(!0)},onRecordStart:()=>{I(C),b(C)},onRecordReady:()=>{const a=A(M.current?.playback.getDurationMs()??0);I(a),b(a)},onApprove:we,onCancel:()=>{I(C),b(C)},onProgressMs:a=>{I(A(a))},onPlaybackPause:()=>{b(A(M.current?.playback.getCurrentTimeMs()??0))},onPlaybackFinish:()=>{b(A(M.current?.playback.getDurationMs()??0))}}});M.current=G;const{state:N,isPlaybackPlaying:P,start:q,stop:Y,approve:K,cancel:J,playback:{play:Q,pause:Z,load:ee,getCurrentTimeMs:T,getDurationMs:te}}=G,k=t.useCallback(async({updateWidgetManager:a,deleteFile:y})=>{const f=m;if(f&&w.current===f&&(URL.revokeObjectURL(f),w.current=null),u.current&&(cancelAnimationFrame(u.current),u.current=null),W(null),V(null),b(C),I(C),J(),a&&o.setFileUploaderStateValue(e,{},{fromUi:!0},i),y&&B)try{await r.deleteFile(B)}catch{}F(f)&&URL.revokeObjectURL(f)},[B,m,r,J,e,o,i,I,V,W]);t.useEffect(()=>{const a=()=>{P&&(b(A(T())),u.current=requestAnimationFrame(a))};return P?u.current=requestAnimationFrame(a):u.current&&(cancelAnimationFrame(u.current),u.current=null),()=>{u.current&&(cancelAnimationFrame(u.current),u.current=null)}},[P,T]),t.useEffect(()=>{if(!m)return;let a=!1;return b(H),(async()=>{try{if(await ee(m),a)return;const f=te();f>0&&b(A(f))}catch{a||h(!0)}})(),()=>{a=!0}},[m,H,ee,te]),t.useEffect(()=>{if(ue(S))return;const a=new Ke;return a.manageFormClearListener(o,S,()=>{k({updateWidgetManager:!0,deleteFile:!1})}),()=>a.disconnect()},[S,k,o]),t.useEffect(()=>()=>{U.current&&(U.current.abort(),U.current=null),u.current&&(cancelAnimationFrame(u.current),u.current=null),w.current&&(URL.revokeObjectURL(w.current),w.current=null)},[]);const Se=t.useCallback(async()=>{try{if(P){const a=T();Z(),b(A(a))}else N==="idle"&&m&&(T()<=100&&b(C),await Q())}catch{h(!0)}},[P,T,Z,Q,m,N]),re=t.useCallback(async()=>{m&&await k({updateWidgetManager:!1,deleteFile:!0});try{b(C),await q()}catch{}},[k,m,q]),oe=t.useCallback(async()=>{try{const{blob:a}=await Y();await K(a)}catch{h(!0)}},[K,Y]),ne=tt(m,"recording.wav"),Ce=t.useCallback(()=>{re()},[re]),Re=t.useCallback(()=>{oe()},[oe]),Ee=t.useCallback(()=>{k({updateWidgetManager:!1,deleteFile:!0}),h(!1)},[k]),ke=t.useCallback(()=>{ne()},[ne]),Ae=t.useCallback(()=>{k({updateWidgetManager:!0,deleteFile:!0})},[k]),$=N==="recording",ae=P,Ie=$?H:O,le=N==="idle"&&!c&&!m,Ue=c||le||d;return x(ot,{className:"stAudioInput","data-testid":"stAudioInput",children:[n(Xe,{label:e.label,disabled:l,labelVisibility:$e(e.labelVisibility?.value),children:e.help&&n(je,{content:e.help,placement:_e.TOP,label:e.label})}),x(de,{disabled:l,children:[x(qe,{isFullScreen:!1,disableFullscreenMode:!0,target:de,children:[m&&n(ce,{label:"Download as WAV",icon:Ze,onClick:ke}),B&&n(ce,{label:"Clear recording",icon:et,onClick:Ae})]}),n(bt,{isRecording:$,isPlaying:ae,isUploading:E,isError:d,recordingUrlExists:!!m,startRecording:Ce,stopRecording:Re,onClickPlayPause:()=>{Se()},onClear:Ee,disabled:l||c}),x(nt,{children:[d&&n(yt,{}),le&&n(Rt,{}),c&&n(St,{}),n(at,{"data-testid":"stAudioInputWaveSurfer",ref:g,show:!Ue})]}),n(lt,{isPlayingOrRecording:$||ae,disabled:l,"data-testid":"stAudioInputWaveformTimeCode",children:Ie})]})]})},Tt=t.memo(Et);export{Tt as default};
1
+ import{r as t,E as L,_ as D,L as ze,e as ue,n as F,aN as se,b_ as Le,bU as De,bT as Be,z as p,j as n,Y as Ve,o as x,B as We,az as Ne,b as Me,l as Oe,ac as He,p as $e,ad as je,P as _e,ae as Xe}from"./index.BHyzKS4e.js";import{u as Ge}from"./useWaveformController.CDLqlnLv.js";import{T as qe,a as ce}from"./Toolbar.BXfC9Z-W.js";import{u as Ke,F as Ye}from"./FormClearHelper.DQoXcOWo.js";import{c as Je}from"./createDownloadLinkElement.YxVC9Qur.js";import{E as Qe}from"./urls.BwSlolu9.js";import{F as Ze,D as et}from"./FileDownload.esm.D-YPxF3t.js";var fe=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.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"}),t.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"}))});fe.displayName="Mic";var pe=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.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"}))});pe.displayName="Pause";var me=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.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"}))});me.displayName="PlayArrow";var ge=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),t.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"}))});ge.displayName="Refresh";var he=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.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"}))});he.displayName="StopCircle";const tt=(e,r)=>{const{enforceDownloadInNewTab:o=!1}=t.useContext(ze);return t.useCallback(()=>{if(!e)return;const l=Je({enforceDownloadInNewTab:o,url:e,filename:r});l.style.display="none",document.body.appendChild(l),l.click(),document.body.removeChild(l)},[e,o,r])},j=({widgetMgr:e,id:r,formId:o,key:i,defaultValue:l})=>{t.useEffect(()=>{const s=e.getElementState(r,i);ue(s)&&F(l)&&e.setElementState(r,i,l)},[e,r,i,l]);const[R,g]=t.useState(e.getElementState(r,i)??l),c=t.useCallback(s=>{e.setElementState(r,i,s),g(s)},[e,r,i]),v=t.useMemo(()=>({formId:o||""}),[o]),E=t.useCallback(()=>c(l),[l,c]);return Ke({element:v,widgetMgr:e,onFormCleared:E}),[R,c]},rt=async({files:e,uploadClient:r,widgetMgr:o,widgetInfo:i,fragmentId:l,signal:R})=>{let g=[];try{g=await r.fetchFileURLs(e)}catch(s){return{successfulUploads:[],failedUploads:e.map(d=>({file:d,error:se(s)}))}}const c=Le(e,g),v=[],E=[];return await Promise.all(c.map(async([s,d])=>{if(!s||!d?.uploadUrl||!d.fileId)return{file:s,fileUrl:d,error:new Error("No upload URL found")};try{await r.uploadFile({id:d.fileId,formId:i.formId||""},d.uploadUrl,s,void 0,R),v.push({fileUrl:d,file:s})}catch(h){const O=se(h);E.push({file:s,error:O})}})),o.setFileUploaderStateValue(i,new De({uploadedFileInfo:v.map(({file:s,fileUrl:d})=>new Be({fileId:d.fileId,fileUrls:d,name:s.webkitRelativePath||s.name,size:s.size}))}),{fromUi:!0},l),{successfulUploads:v,failedUploads:E}},ot=p("div",{target:"e18uw4vz0"})(),de=p("div",{target:"e18uw4vz1"})(({theme:e,disabled:r})=>({height:e.sizes.largestElementHeight,width:"100%",background:e.colors.secondaryBg,borderRadius:e.radii.default,marginBottom:e.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:e.spacing.xs,paddingRight:e.spacing.sm,border:e.colors.widgetBorderColor?`${e.sizes.borderWidth} solid ${e.colors.widgetBorderColor}`:void 0,cursor:r?"not-allowed":"auto",overflow:"hidden"})),nt=p("div",{target:"e18uw4vz2"})({flex:1}),at=p("div",{target:"e18uw4vz3"})(({show:e,theme:r})=>({display:e?"block":"none",position:"relative",height:r.sizes.largestElementHeight,"& > div":{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center"}})),lt=p("span",{target:"e18uw4vz4"})(({theme:e,isPlayingOrRecording:r,disabled:o})=>({margin:e.spacing.sm,fontFamily:e.fonts.monospace,color:o?e.colors.fadedText40:r?e.colors.bodyText:e.colors.fadedText60,backgroundColor:e.colors.secondaryBg,fontSize:e.fontSizes.sm})),be=p("div",{target:"e18uw4vz5"})({width:"100%",textAlign:"center",overflow:"hidden"}),ve=p("span",{target:"e18uw4vz6"})(({theme:e})=>({color:e.colors.bodyText})),it=p("a",{target:"e18uw4vz7"})(({theme:e})=>({color:e.colors.link,textDecoration:e.linkUnderline?"underline":"none"})),st=p("div",{target:"e18uw4vz8"})(({theme:e})=>({flex:1,height:e.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"})),ct=p("div",{target:"e18uw4vz9"})(({theme:e})=>{const r="0.625em";return{opacity:.2,width:"100%",height:r,backgroundSize:r,backgroundImage:`radial-gradient(${e.colors.fadedText10} 40%, transparent 40%)`,backgroundRepeat:"repeat"}}),dt=p("span",{target:"e18uw4vz10"})(({theme:e})=>({"& > button":{color:e.colors.primary,padding:e.spacing.threeXS},"& > button:hover, & > button:focus":{color:e.colors.redColor}})),ut=p("span",{target:"e18uw4vz11"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}})),ye=p("span",{target:"e18uw4vz12"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}})),_=p("div",{target:"e18uw4vz13"})(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:e.spacing.xs,gap:e.spacing.twoXS,marginRight:e.spacing.twoXS})),z=({onClick:e,disabled:r,ariaLabel:o,iconContent:i})=>n(Me,{kind:We.BORDERLESS_ICON,onClick:e,disabled:r,"aria-label":o,containerWidth:!0,"data-testid":"stAudioInputActionButton",children:n(Ne,{content:i,size:"lg",color:"inherit"})}),ft=({disabled:e,stopRecording:r})=>n(dt,{children:n(z,{onClick:r,disabled:e,ariaLabel:"Stop recording",iconContent:he})}),pt=({disabled:e,isPlaying:r,onClickPlayPause:o})=>n(ye,{children:r?n(z,{onClick:o,disabled:e,ariaLabel:"Pause",iconContent:pe}):n(z,{onClick:o,disabled:e,ariaLabel:"Play",iconContent:me})}),mt=({disabled:e,startRecording:r})=>n(ut,{children:n(z,{onClick:r,disabled:e,ariaLabel:"Record",iconContent:fe})}),gt=({onClick:e})=>n(ye,{children:n(z,{disabled:!1,onClick:e,ariaLabel:"Reset",iconContent:ge})}),ht=({disabled:e,isRecording:r,isPlaying:o,isUploading:i,isError:l,recordingUrlExists:R,startRecording:g,stopRecording:c,onClickPlayPause:v,onClear:E})=>l?n(_,{children:n(gt,{onClick:E})}):i?n(_,{children:n(Ve,{size:"base",iconValue:"spinner"})}):x(_,{children:[r?n(ft,{disabled:e,stopRecording:c}):n(mt,{disabled:e,startRecording:g}),R&&n(pt,{disabled:e,isPlaying:o,onClickPlayPause:v})]}),bt=t.memo(ht),vt=()=>n(be,{children:n(ve,{children:"An error has occurred, please try again."})}),yt=t.memo(vt),C="00:00",A=e=>{const r=Math.floor(e/1e3),o=Math.floor(r/60),i=Math.floor(o/60),l=r%60,R=o%60,g=l.toString().padStart(2,"0"),c=R.toString().padStart(2,"0"),v=i.toString().padStart(2,"0");return o<60?`${c}:${g}`:`${v}:${c}:${g}`},wt=()=>x(be,{children:[n(ve,{children:"This app would like to use your microphone."})," ",n(it,{href:Qe,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]}),St=t.memo(wt),Ct=()=>n(st,{children:n(ct,{})}),Rt=t.memo(Ct),Et=({element:e,uploadClient:r,widgetMgr:o,fragmentId:i,disabled:l})=>{const R=Oe(),g=t.useRef(null),[c,v]=t.useState(!1),[E,s]=t.useState(!1),[d,h]=t.useState(!1),[O,b]=t.useState(C),[B,V]=j({widgetMgr:o,id:e.id,key:"deleteFileUrl",defaultValue:null}),[m,W]=j({widgetMgr:o,id:e.id,key:"recordingUrl",defaultValue:null}),[H,U]=j({widgetMgr:o,id:e.id,formId:e.formId,key:"recordingTime",defaultValue:C}),I=t.useRef(null),w=t.useRef(null),u=t.useRef(null),X=e.id,S=e.formId,we=t.useCallback(async a=>{I.current&&I.current.abort();const y=new AbortController;I.current=y;try{if(s(!0),F(S)&&o.setFormsWithUploadsInProgress(new Set([S])),y.signal.aborted)return;let f;try{f=URL.createObjectURL(a),w.current&&w.current!==f&&URL.revokeObjectURL(w.current),w.current=f}catch{h(!0),s(!1),F(S)&&o.setFormsWithUploadsInProgress(new Set);return}if(y.signal.aborted){URL.revokeObjectURL(f),w.current=null;return}W(f);const Pe=new Date().toISOString().slice(0,16).replace(/:/g,"-"),Fe=new File([a],`${Pe}_audio.wav`,{type:a.type});try{const{successfulUploads:xe,failedUploads:Te}=await rt({files:[Fe],uploadClient:r,widgetMgr:o,widgetInfo:{id:X,formId:S},fragmentId:i,signal:y.signal});if(y.signal.aborted)return;if(Te.length>0){h(!0);return}h(!1);const ie=xe[0];ie?.fileUrl?.deleteUrl&&V(ie.fileUrl.deleteUrl)}catch{y.signal.aborted||h(!0)}finally{F(S)&&o.setFormsWithUploadsInProgress(new Set),y.signal.aborted||s(!1)}}catch{y.signal.aborted||(h(!0),s(!1)),F(S)&&o.setFormsWithUploadsInProgress(new Set)}},[r,o,X,S,i,V,W]),N=t.useRef(null),G=Ge({containerRef:g,sampleRate:e.sampleRate??void 0,waveformPadding:He(R.spacing.twoXS),events:{onPermissionDenied:()=>{v(!0)},onError:()=>{h(!0)},onRecordStart:()=>{U(C),b(C)},onRecordReady:()=>{const a=A(N.current?.playback.getDurationMs()??0);U(a),b(a)},onApprove:we,onCancel:()=>{U(C),b(C)},onProgressMs:a=>{U(A(a))},onPlaybackPause:()=>{b(A(N.current?.playback.getCurrentTimeMs()??0))},onPlaybackFinish:()=>{b(A(N.current?.playback.getDurationMs()??0))}}});N.current=G;const{state:M,isPlaybackPlaying:P,start:q,stop:K,approve:Y,cancel:J,playback:{play:Q,pause:Z,load:ee,getCurrentTimeMs:T,getDurationMs:te}}=G,k=t.useCallback(async({updateWidgetManager:a,deleteFile:y})=>{const f=m;if(f&&w.current===f&&(URL.revokeObjectURL(f),w.current=null),u.current&&(cancelAnimationFrame(u.current),u.current=null),W(null),V(null),b(C),U(C),J(),a&&o.setFileUploaderStateValue(e,{},{fromUi:!0},i),y&&B)try{await r.deleteFile(B)}catch{}F(f)&&URL.revokeObjectURL(f)},[B,m,r,J,e,o,i,U,V,W]);t.useEffect(()=>{const a=()=>{P&&(b(A(T())),u.current=requestAnimationFrame(a))};return P?u.current=requestAnimationFrame(a):u.current&&(cancelAnimationFrame(u.current),u.current=null),()=>{u.current&&(cancelAnimationFrame(u.current),u.current=null)}},[P,T]),t.useEffect(()=>{if(!m)return;let a=!1;return b(H),(async()=>{try{if(await ee(m),a)return;const f=te();f>0&&b(A(f))}catch{a||h(!0)}})(),()=>{a=!0}},[m,H,ee,te]),t.useEffect(()=>{if(ue(S))return;const a=new Ye;return a.manageFormClearListener(o,S,()=>{k({updateWidgetManager:!0,deleteFile:!1})}),()=>a.disconnect()},[S,k,o]),t.useEffect(()=>()=>{I.current&&(I.current.abort(),I.current=null),u.current&&(cancelAnimationFrame(u.current),u.current=null),w.current&&(URL.revokeObjectURL(w.current),w.current=null)},[]);const Se=t.useCallback(async()=>{try{if(P){const a=T();Z(),b(A(a))}else M==="idle"&&m&&(T()<=100&&b(C),await Q())}catch{h(!0)}},[P,T,Z,Q,m,M]),re=t.useCallback(async()=>{m&&await k({updateWidgetManager:!1,deleteFile:!0});try{b(C),await q()}catch{}},[k,m,q]),oe=t.useCallback(async()=>{try{const{blob:a}=await K();await Y(a)}catch{h(!0)}},[Y,K]),ne=tt(m,"recording.wav"),Ce=t.useCallback(()=>{re()},[re]),Re=t.useCallback(()=>{oe()},[oe]),Ee=t.useCallback(()=>{k({updateWidgetManager:!1,deleteFile:!0}),h(!1)},[k]),ke=t.useCallback(()=>{ne()},[ne]),Ae=t.useCallback(()=>{k({updateWidgetManager:!0,deleteFile:!0})},[k]),$=M==="recording",ae=P,Ue=$?H:O,le=M==="idle"&&!c&&!m,Ie=c||le||d;return x(ot,{className:"stAudioInput","data-testid":"stAudioInput",children:[n(Xe,{label:e.label,disabled:l,labelVisibility:$e(e.labelVisibility?.value),children:e.help&&n(je,{content:e.help,placement:_e.TOP,label:e.label})}),x(de,{disabled:l,children:[x(qe,{isFullScreen:!1,disableFullscreenMode:!0,target:de,children:[m&&n(ce,{label:"Download as WAV",icon:Ze,onClick:ke}),B&&n(ce,{label:"Clear recording",icon:et,onClick:Ae})]}),n(bt,{isRecording:$,isPlaying:ae,isUploading:E,isError:d,recordingUrlExists:!!m,startRecording:Ce,stopRecording:Re,onClickPlayPause:()=>{Se()},onClear:Ee,disabled:l||c}),x(nt,{children:[d&&n(yt,{}),le&&n(Rt,{}),c&&n(St,{}),n(at,{"data-testid":"stAudioInputWaveSurfer",ref:g,show:!Ie})]}),n(lt,{isPlayingOrRecording:$||ae,disabled:l,"data-testid":"stAudioInputWaveformTimeCode",children:Ue})]})]})},Tt=t.memo(Et);export{Tt as default};
@@ -1 +1 @@
1
- import{W as f,a6 as p,B as i,r as l,u as h,j as o,a as S,b as F,c as I,D as R,d as C,a7 as M}from"./index.CPc_uZux.js";import{a8 as D}from"./index.CPc_uZux.js";import{m as x}from"./iconPosition.BVScIr6G.js";import{F as E,u as O}from"./FormClearHelper.DTFnX0js.js";function y(a){const{disabled:d,element:t,widgetMgr:e,fragmentId:u}=a,{formId:s}=t,m=t.shortcut?t.shortcut:void 0,{formsData:B}=f(p),b=B.formsWithUploads.has(s);let n=i.SECONDARY_FORM_SUBMIT;t.type==="primary"?n=i.PRIMARY_FORM_SUBMIT:t.type==="tertiary"&&(n=i.TERTIARY_FORM_SUBMIT);const r=d||b;l.useEffect(()=>(e.addSubmitButton(s,t),()=>e.removeSubmitButton(s,t)),[e,s,t]);const c=l.useCallback(()=>{r||e.submitForm(t.formId,u,t)},[r,e,t,u]);return h({shortcut:m,disabled:r,onActivate:c}),o(C,{className:"stFormSubmitButton","data-testid":"stFormSubmitButton",children:o(S,{help:t.help,containerWidth:!0,children:o(F,{kind:n,size:I.SMALL,containerWidth:!0,disabled:r,onClick:c,children:o(R,{icon:t.icon,iconPosition:x(t.iconPosition),label:t.label,shortcut:m})})})})}function _(a){return o(M,{children:o(y,{...a})})}export{E as FormClearHelper,y as FormSubmitButton,_ as FormSubmitContent,D as default,O as useFormClearHelper};
1
+ import{W as f,a8 as p,B as i,r as l,u as h,j as o,a as S,b as F,c as I,D as R,d as C,a9 as M}from"./index.BHyzKS4e.js";import{aa as D}from"./index.BHyzKS4e.js";import{m as x}from"./iconPosition.C47DkA-1.js";import{F as E,u as O}from"./FormClearHelper.DQoXcOWo.js";function y(a){const{disabled:d,element:t,widgetMgr:e,fragmentId:u}=a,{formId:s}=t,m=t.shortcut?t.shortcut:void 0,{formsData:B}=f(p),b=B.formsWithUploads.has(s);let n=i.SECONDARY_FORM_SUBMIT;t.type==="primary"?n=i.PRIMARY_FORM_SUBMIT:t.type==="tertiary"&&(n=i.TERTIARY_FORM_SUBMIT);const r=d||b;l.useEffect(()=>(e.addSubmitButton(s,t),()=>e.removeSubmitButton(s,t)),[e,s,t]);const c=l.useCallback(()=>{r||e.submitForm(t.formId,u,t)},[r,e,t,u]);return h({shortcut:m,disabled:r,onActivate:c}),o(C,{className:"stFormSubmitButton","data-testid":"stFormSubmitButton",children:o(S,{help:t.help,containerWidth:!0,children:o(F,{kind:n,size:I.SMALL,containerWidth:!0,disabled:r,onClick:c,children:o(R,{icon:t.icon,iconPosition:x(t.iconPosition),label:t.label,shortcut:m})})})})}function _(a){return o(M,{children:o(y,{...a})})}export{E as FormClearHelper,y as FormSubmitButton,_ as FormSubmitContent,D as default,O as useFormClearHelper};
@@ -1 +1 @@
1
- import{z as i,a3 as m,r as c,j as n,b2 as p}from"./index.CPc_uZux.js";import{P as d,R as f}from"./Particles.12xFSjcn.js";const g=""+new URL("../media/balloon-0.Czj7AKwE.png",import.meta.url).href,B=""+new URL("../media/balloon-1.CNvFFrND.png",import.meta.url).href,h=""+new URL("../media/balloon-2.DTvC6B1t.png",import.meta.url).href,L=""+new URL("../media/balloon-3.CgSk4tbL.png",import.meta.url).href,u=""+new URL("../media/balloon-4.mbtFrzxf.png",import.meta.url).href,x=""+new URL("../media/balloon-5.CSwkUfRA.png",import.meta.url).href,t=300,e=121,s=20,A=80,_=1e3,b=m("from{transform:translateY(calc(100vh + ",t,"px));}to{transform:translateY(0);}"),I=i("img",{target:"e19msdho0"})(({theme:o})=>({position:"fixed",top:`${-t}px`,marginLeft:`${-e/2}px`,zIndex:o.zIndices.balloons,left:`${Math.random()*(A-s)+s}vw`,animationDelay:`${Math.random()*_}ms`,height:`${t}px`,width:`${e}px`,pointerEvents:"none",animationDuration:"750ms",animationName:b,animationTimingFunction:"ease-in",animationDirection:"normal",animationIterationCount:1,opacity:1})),M=30,l=[g,B,h,L,u,x],w=l.length,E=({particleType:o,resourceCrossOriginMode:r})=>{const a=l[o];return n(I,{src:a,crossOrigin:p(r,a)})},N=({scriptRunId:o})=>n(f,{children:n(d,{className:"stBalloons","data-testid":"stBalloons",scriptRunId:o,numParticleTypes:w,numParticles:M,ParticleComponent:E})}),P=c.memo(N);export{M as NUM_BALLOONS,P as default};
1
+ import{z as i,a3 as m,r as c,j as n,bb as p}from"./index.BHyzKS4e.js";import{P as d,R as f}from"./Particles.BdQSRZde.js";const g=""+new URL("../media/balloon-0.Czj7AKwE.png",import.meta.url).href,B=""+new URL("../media/balloon-1.CNvFFrND.png",import.meta.url).href,h=""+new URL("../media/balloon-2.DTvC6B1t.png",import.meta.url).href,L=""+new URL("../media/balloon-3.CgSk4tbL.png",import.meta.url).href,u=""+new URL("../media/balloon-4.mbtFrzxf.png",import.meta.url).href,b=""+new URL("../media/balloon-5.CSwkUfRA.png",import.meta.url).href,t=300,e=121,s=20,x=80,A=1e3,_=m("from{transform:translateY(calc(100vh + ",t,"px));}to{transform:translateY(0);}"),I=i("img",{target:"e19msdho0"})(({theme:o})=>({position:"fixed",top:`${-t}px`,marginLeft:`${-e/2}px`,zIndex:o.zIndices.balloons,left:`${Math.random()*(x-s)+s}vw`,animationDelay:`${Math.random()*A}ms`,height:`${t}px`,width:`${e}px`,pointerEvents:"none",animationDuration:"750ms",animationName:_,animationTimingFunction:"ease-in",animationDirection:"normal",animationIterationCount:1,opacity:1})),M=30,l=[g,B,h,L,u,b],w=l.length,E=({particleType:o,resourceCrossOriginMode:r})=>{const a=l[o];return n(I,{src:a,crossOrigin:p(r,a)})},N=({scriptRunId:o})=>n(f,{children:n(d,{className:"stBalloons","data-testid":"stBalloons",scriptRunId:o,numParticleTypes:w,numParticles:M,ParticleComponent:E})}),P=c.memo(N);export{M as NUM_BALLOONS,P as default};
@@ -1 +1 @@
1
- import{z as e,r as a,o as t,j as r,q as o}from"./index.CPc_uZux.js";import{P as i}from"./ProgressBar.Dg-oMbWg.js";const l=e("div",{target:"e1jwj65h0"})(({theme:s})=>({paddingBottom:s.spacing.sm,lineHeight:"normal"}));function n({element:s}){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})]})}const m=a.memo(n);export{m as default};
1
+ import{z as e,r as a,o as t,j as r,q as o}from"./index.BHyzKS4e.js";import{P as i}from"./ProgressBar.DNF_pWKr.js";const l=e("div",{target:"e1jwj65h0"})(({theme:s})=>({paddingBottom:s.spacing.sm,lineHeight:"normal"}));function n({element:s}){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})]})}const m=a.memo(n);export{m as default};
@@ -1 +1 @@
1
- import{r as m,l as x,m as C,j as s,o as T,p as y,q as L,P as S,t as W,C as B,v as w}from"./index.CPc_uZux.js";import{W as R}from"./WidgetLabelHelpIconInline.Dlc8f0Ji.js";import{u as E}from"./useBasicWidgetState.DvpdEDYZ.js";import{S as P,L as v,a as u}from"./checkbox.BKgWNdeI.js";import"./FormClearHelper.DTFnX0js.js";function $({element:o,disabled:a,widgetMgr:n,fragmentId:d}){const[p,g]=E({getStateFromWidgetMgr:M,getDefaultStateFromProto:X,getCurrStateFromProto:H,updateWidgetMgrState:V,element:o,widgetMgr:n,fragmentId:d}),f=m.useCallback(i=>{g({value:i.target.checked,fromUi:!0})},[g]),t=x(),{colors:r,spacing:h,sizes:e}=t,b=C(t),k=a?r.fadedText40:r.bodyText;return s(w,{className:"row-widget stCheckbox","data-testid":"stCheckbox",children:s(P,{checked:p,disabled:a,onChange:f,"aria-label":o.label,checkmarkType:o.type===B.StyleType.TOGGLE?u.toggle:u.default,labelPlacement:v.right,overrides:{Root:{style:({$isFocusVisible:i})=>({marginBottom:h.none,marginTop:h.none,backgroundColor:i?r.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:i})=>{let c=b?r.bgColor:r.bodyText;return a&&(c=b?r.gray70:r.gray90),{width:`calc(${e.checkbox} - ${t.spacing.twoXS})`,height:`calc(${e.checkbox} - ${t.spacing.twoXS})`,transform:i?`translateX(${e.checkbox})`:"",backgroundColor:c,boxShadow:""}}},ToggleTrack:{style:({$checked:i,$isHovered:c})=>{let l=r.borderColor;return c&&!a&&(l=r.darkenedBgMix15),i&&!a&&(l=r.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:t.spacing.twoXS,paddingLeft:t.spacing.threeXS,paddingRight:t.spacing.threeXS,width:`calc(2 * ${e.checkbox})`,minWidth:`calc(2 * ${e.checkbox})`,height:e.checkbox,minHeight:e.checkbox,borderBottomLeftRadius:t.radii.full,borderTopLeftRadius:t.radii.full,borderBottomRightRadius:t.radii.full,borderTopRightRadius:t.radii.full,backgroundColor:l}}},Checkmark:{style:({$isFocusVisible:i,$checked:c})=>{const l=c&&!a?r.primary:r.borderColor;return{outline:0,width:e.checkbox,height:e.checkbox,marginTop:t.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:i&&c?t.shadows.focusRing:"",borderLeftWidth:e.borderWidth,borderRightWidth:e.borderWidth,borderTopWidth:e.borderWidth,borderBottomWidth:e.borderWidth,borderLeftColor:l,borderRightColor:l,borderTopColor:l,borderBottomColor:l}}},Label:{style:{lineHeight:t.lineHeights.small,paddingLeft:t.spacing.sm,position:"relative",color:k}}},children:T(W,{visibility:y(o.labelVisibility?.value),"data-testid":"stWidgetLabel",children:[s(L,{source:o.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),o.help&&s(R,{content:o.help,placement:S.TOP_RIGHT,label:o.label})]})})})}function M(o,a){return o.getBoolValue(a)}function X(o){return o.default??null}function H(o){return o.value??null}function V(o,a,n,d){a.setBoolValue(o,n.value,{fromUi:n.fromUi},d)}const _=m.memo($);export{_ as default};
1
+ import{r as m,l as x,m as C,j as s,o as T,p as y,q as L,P as S,t as W,C as B,v as w}from"./index.BHyzKS4e.js";import{W as R}from"./WidgetLabelHelpIconInline.gkreC55g.js";import{u as E}from"./useBasicWidgetState.BXKaD8DQ.js";import{S as P,L as v,a as u}from"./checkbox.Bqz68SYq.js";import"./FormClearHelper.DQoXcOWo.js";function $({element:o,disabled:a,widgetMgr:n,fragmentId:d}){const[p,g]=E({getStateFromWidgetMgr:M,getDefaultStateFromProto:X,getCurrStateFromProto:H,updateWidgetMgrState:V,element:o,widgetMgr:n,fragmentId:d}),f=m.useCallback(i=>{g({value:i.target.checked,fromUi:!0})},[g]),t=x(),{colors:r,spacing:h,sizes:e}=t,b=C(t),k=a?r.fadedText40:r.bodyText;return s(w,{className:"row-widget stCheckbox","data-testid":"stCheckbox",children:s(P,{checked:p,disabled:a,onChange:f,"aria-label":o.label,checkmarkType:o.type===B.StyleType.TOGGLE?u.toggle:u.default,labelPlacement:v.right,overrides:{Root:{style:({$isFocusVisible:i})=>({marginBottom:h.none,marginTop:h.none,backgroundColor:i?r.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:i})=>{let c=b?r.bgColor:r.bodyText;return a&&(c=b?r.gray70:r.gray90),{width:`calc(${e.checkbox} - ${t.spacing.twoXS})`,height:`calc(${e.checkbox} - ${t.spacing.twoXS})`,transform:i?`translateX(${e.checkbox})`:"",backgroundColor:c,boxShadow:""}}},ToggleTrack:{style:({$checked:i,$isHovered:c})=>{let l=r.borderColor;return c&&!a&&(l=r.darkenedBgMix15),i&&!a&&(l=r.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:t.spacing.twoXS,paddingLeft:t.spacing.threeXS,paddingRight:t.spacing.threeXS,width:`calc(2 * ${e.checkbox})`,minWidth:`calc(2 * ${e.checkbox})`,height:e.checkbox,minHeight:e.checkbox,borderBottomLeftRadius:t.radii.full,borderTopLeftRadius:t.radii.full,borderBottomRightRadius:t.radii.full,borderTopRightRadius:t.radii.full,backgroundColor:l}}},Checkmark:{style:({$isFocusVisible:i,$checked:c})=>{const l=c&&!a?r.primary:r.borderColor;return{outline:0,width:e.checkbox,height:e.checkbox,marginTop:t.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:i&&c?t.shadows.focusRing:"",borderLeftWidth:e.borderWidth,borderRightWidth:e.borderWidth,borderTopWidth:e.borderWidth,borderBottomWidth:e.borderWidth,borderLeftColor:l,borderRightColor:l,borderTopColor:l,borderBottomColor:l}}},Label:{style:{lineHeight:t.lineHeights.small,paddingLeft:t.spacing.sm,position:"relative",color:k}}},children:T(W,{visibility:y(o.labelVisibility?.value),"data-testid":"stWidgetLabel",children:[s(L,{source:o.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),o.help&&s(R,{content:o.help,placement:S.TOP_RIGHT,label:o.label})]})})})}function M(o,a){return o.getBoolValue(a)}function X(o){return o.default??null}function H(o){return o.value??null}function V(o,a,n,d){a.setBoolValue(o,n.value,{fromUi:n.fromUi},d)}const _=m.memo($);export{_ as default};
@@ -1 +1 @@
1
- import{p as W,aA as O,z as _,r as i,k as $,l as q,a9 as S,aa as G,o as M,j as c,ab as N,ac as J,ae as Q}from"./index.CPc_uZux.js";import{I as X}from"./InputInstructions.CdzsN_Va.js";import{u as Y}from"./useBasicWidgetState.DvpdEDYZ.js";import{u as Z,a as tt,b as et}from"./useUpdateUiValue.DQ4RuJNC.js";import{u as ot,T as at}from"./useTextInputAutoExpand.BIApLJKn.js";import{u as it}from"./uniqueId.DTwvAE-J.js";import"./FormClearHelper.DTFnX0js.js";import"./inputUtils.CptNuJwn.js";import"./base-input.Q-zJLgRK.js";const st=(e,t)=>{let a="auto";if(e.heightConfig?.useStretch)a="100%";else if(e.heightConfig?.pixelHeight&&e.heightConfig.pixelHeight>0){const s=W(t.labelVisibility?.value)===O.Collapsed?2:30,l=e.heightConfig.pixelHeight-s;a=`${Math.max(0,l)}px`}return a},rt=_("div",{target:"e1tmb1p40"})({height:"100%",display:"flex",flexDirection:"column"}),T=(e,t)=>e.getStringValue(t)??t.default??null,lt=e=>e.default??null,nt=e=>e.value??null,ut=(e,t,a,s)=>{t.setStringValue(e,a.value,{fromUi:a.fromUi},s)},dt=({disabled:e,element:t,widgetMgr:a,fragmentId:s,outerElement:l})=>{const h=i.useRef(it("text_area_")).current,{width:y,elementRef:V}=$(),[r,g]=i.useState(!1),[I,x]=i.useState(!1),n=l.heightConfig?.useContent??!1,v=l.heightConfig?.useStretch??!1,A=st(l,t),C=i.useRef(null),[u,p]=i.useState(()=>T(a,t)??null),F=i.useCallback(()=>{p(t.default??null),g(!0)},[t]),[R,f]=Y({getStateFromWidgetMgr:T,getDefaultStateFromProto:lt,getCurrStateFromProto:nt,updateWidgetMgrState:ut,element:t,widgetMgr:a,fragmentId:s,onFormCleared:F});Z(R,u,p,r);const o=q(),{height:k,maxHeight:z,updateScrollHeight:H}=ot({textareaRef:C,dependencies:[t.placeholder]}),m=i.useCallback(()=>{g(!1),f({value:u,fromUi:!0})},[u,f]),L=i.useCallback(()=>{r&&m(),x(!1)},[r,m]),B=i.useCallback(()=>{x(!0)},[]),D=i.useCallback(()=>{n&&H()},[n,H]),E=tt({formId:t.formId,maxChars:t.maxChars,setDirty:g,setUiValue:p,setValueWithSource:f,additionalAction:D}),U=et(t.formId,m,r,a,s,!0),{placeholder:P,formId:b}=t,j=S({formId:b})?a.allowFormEnterToSubmit(b):r,w=I&&y>G(o.breakpoints.hideWidgetDetails);return M(rt,{className:"stTextArea","data-testid":"stTextArea",ref:V,children:[c(J,{label:t.label,disabled:e,labelVisibility:W(t.labelVisibility?.value),htmlFor:h,children:t.help&&c(N,{content:t.help,label:t.label})}),c(at,{inputRef:n?C:void 0,value:u??"",placeholder:P,onBlur:L,onFocus:B,onChange:E,onKeyDown:U,"aria-label":t.label,disabled:e,id:h,overrides:{Input:{style:{fontWeight:o.fontWeights.normal,lineHeight:o.lineHeights.inputWidget,height:n?k:A,maxHeight:n?z:"",minHeight:o.sizes.largestElementHeight,resize:v?"none":"vertical",paddingRight:o.spacing.md,paddingLeft:o.spacing.md,paddingBottom:o.spacing.md,paddingTop:o.spacing.md,"::placeholder":{color:o.colors.fadedText60}}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:({$isFocused:K})=>{const d=Q(o.colors,K);return{borderLeftWidth:o.sizes.borderWidth,borderRightWidth:o.sizes.borderWidth,borderTopWidth:o.sizes.borderWidth,borderBottomWidth:o.sizes.borderWidth,borderTopColor:d,borderRightColor:d,borderBottomColor:d,borderLeftColor:d,flexGrow:1}}}}}),w&&c(X,{dirty:r,value:u??"",maxLength:t.maxChars,type:"multiline",inForm:S({formId:b}),allowEnterToSubmit:j})]})},Ht=i.memo(dt);export{Ht as default};
1
+ import{p as W,aC as O,z as _,r as i,k as $,l as q,ab as S,ac as G,o as M,j as c,ad as N,ae as J,ag as Q}from"./index.BHyzKS4e.js";import{I as X}from"./InputInstructions.C7VMyGT7.js";import{u as Y}from"./useBasicWidgetState.BXKaD8DQ.js";import{u as Z,a as tt,b as et}from"./useUpdateUiValue.CIUgfO8X.js";import{u as ot,T as at}from"./useTextInputAutoExpand.CVd5Hf2S.js";import{u as it}from"./uniqueId.Bd_Iuzvc.js";import"./FormClearHelper.DQoXcOWo.js";import"./inputUtils.CptNuJwn.js";import"./base-input.iB32RS3w.js";const st=(e,t)=>{let a="auto";if(e.heightConfig?.useStretch)a="100%";else if(e.heightConfig?.pixelHeight&&e.heightConfig.pixelHeight>0){const s=W(t.labelVisibility?.value)===O.Collapsed?2:30,l=e.heightConfig.pixelHeight-s;a=`${Math.max(0,l)}px`}return a},rt=_("div",{target:"e1tmb1p40"})({height:"100%",display:"flex",flexDirection:"column"}),T=(e,t)=>e.getStringValue(t)??t.default??null,lt=e=>e.default??null,nt=e=>e.value??null,dt=(e,t,a,s)=>{t.setStringValue(e,a.value,{fromUi:a.fromUi},s)},ut=({disabled:e,element:t,widgetMgr:a,fragmentId:s,outerElement:l})=>{const h=i.useRef(it("text_area_")).current,{width:y,elementRef:V}=$(),[r,g]=i.useState(!1),[I,x]=i.useState(!1),n=l.heightConfig?.useContent??!1,v=l.heightConfig?.useStretch??!1,A=st(l,t),C=i.useRef(null),[d,p]=i.useState(()=>T(a,t)??null),F=i.useCallback(()=>{p(t.default??null),g(!0)},[t]),[R,f]=Y({getStateFromWidgetMgr:T,getDefaultStateFromProto:lt,getCurrStateFromProto:nt,updateWidgetMgrState:dt,element:t,widgetMgr:a,fragmentId:s,onFormCleared:F});Z(R,d,p,r);const o=q(),{height:k,maxHeight:z,updateScrollHeight:H}=ot({textareaRef:C,dependencies:[t.placeholder]}),m=i.useCallback(()=>{g(!1),f({value:d,fromUi:!0})},[d,f]),L=i.useCallback(()=>{r&&m(),x(!1)},[r,m]),B=i.useCallback(()=>{x(!0)},[]),D=i.useCallback(()=>{n&&H()},[n,H]),E=tt({formId:t.formId,maxChars:t.maxChars,setDirty:g,setUiValue:p,setValueWithSource:f,additionalAction:D}),U=et(t.formId,m,r,a,s,!0),{placeholder:P,formId:b}=t,j=S({formId:b})?a.allowFormEnterToSubmit(b):r,w=I&&y>G(o.breakpoints.hideWidgetDetails);return M(rt,{className:"stTextArea","data-testid":"stTextArea",ref:V,children:[c(J,{label:t.label,disabled:e,labelVisibility:W(t.labelVisibility?.value),htmlFor:h,children:t.help&&c(N,{content:t.help,label:t.label})}),c(at,{inputRef:n?C:void 0,value:d??"",placeholder:P,onBlur:L,onFocus:B,onChange:E,onKeyDown:U,"aria-label":t.label,disabled:e,id:h,overrides:{Input:{style:{fontWeight:o.fontWeights.normal,lineHeight:o.lineHeights.inputWidget,height:n?k:A,maxHeight:n?z:"",minHeight:o.sizes.largestElementHeight,resize:v?"none":"vertical",paddingRight:o.spacing.md,paddingLeft:o.spacing.md,paddingBottom:o.spacing.md,paddingTop:o.spacing.md,"::placeholder":{color:o.colors.fadedText60}}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:({$isFocused:K})=>{const u=Q(o.colors,K);return{borderLeftWidth:o.sizes.borderWidth,borderRightWidth:o.sizes.borderWidth,borderTopWidth:o.sizes.borderWidth,borderBottomWidth:o.sizes.borderWidth,borderTopColor:u,borderRightColor:u,borderBottomColor:u,borderLeftColor:u,flexGrow:1}}}}}),w&&c(X,{dirty:r,value:d??"",maxLength:t.maxChars,type:"multiline",inForm:S({formId:b}),allowEnterToSubmit:j})]})},Ht=i.memo(ut);export{Ht as default};
@@ -1 +1 @@
1
- import{z as c,r as a,j as o,o as u,ak as g,Y as f,q as S}from"./index.CPc_uZux.js";const x=c("div",{target:"e1l5y6pi0"})(({theme:e,cache:n})=>({...n?{paddingBottom:e.spacing.lg,background:`linear-gradient(to bottom, ${e.colors.bgColor} 0%, ${e.colors.bgColor} 80%, transparent 100%)`}:null})),T=c("div",{target:"e1l5y6pi1"})(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",gap:e.spacing.sm})),$=c("div",{target:"e1l5y6pi2"})(({theme:e})=>({display:"flex",gap:e.spacing.sm,alignItems:"baseline"})),h=c("span",{target:"e1l5y6pi3"})(({theme:e})=>({opacity:.6,fontSize:e.fontSizes.sm,lineHeight:e.lineHeights.none,whiteSpace:"nowrap"})),y=e=>{const n=Math.floor(e/3600),t=Math.floor(e%3600/60),s=e%60;if(n===0&&t===0)return`(${s.toFixed(1)} seconds)`;if(n===0){const p=`${t} minute${t===1?"":"s"}`,d=s===0?"":`, ${s.toFixed(1)} seconds`;return`(${p}${d})`}const l=`${n} hour${n===1?"":"s"}`,i=t===0?"":`, ${t} minute${t===1?"":"s"}`,r=s===0?"":`, ${s.toFixed(1)} seconds`;return`(${l}${i}${r})`};function w({element:e}){const{cache:n,showTime:t}=e,[s,l]=a.useState(0),i=a.useRef(null);return a.useEffect(()=>{if(!t)return;i.current=Date.now();const r=()=>{if(i.current!==null){const m=(Date.now()-i.current)/1e3;l(m)}};r();const p=setInterval(r,100);return()=>clearInterval(p)},[t]),o(x,{className:g({stSpinner:!0,stCacheSpinner:n}),"data-testid":"stSpinner",cache:n,children:u(T,{children:[o(f,{size:"lg",iconValue:"spinner"}),u($,{children:[o(S,{source:e.text,allowHTML:!1}),t&&o(h,{children:y(s)})]})]})})}const v=a.memo(w);export{v as default};
1
+ import{z as c,r as a,j as o,o as u,am as g,Y as f,q as S}from"./index.BHyzKS4e.js";const x=c("div",{target:"e1l5y6pi0"})(({theme:e,cache:n})=>({...n?{paddingBottom:e.spacing.lg,background:`linear-gradient(to bottom, ${e.colors.bgColor} 0%, ${e.colors.bgColor} 80%, transparent 100%)`}:null})),T=c("div",{target:"e1l5y6pi1"})(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",gap:e.spacing.sm})),$=c("div",{target:"e1l5y6pi2"})(({theme:e})=>({display:"flex",gap:e.spacing.sm,alignItems:"baseline"})),h=c("span",{target:"e1l5y6pi3"})(({theme:e})=>({opacity:.6,fontSize:e.fontSizes.sm,lineHeight:e.lineHeights.none,whiteSpace:"nowrap"})),y=e=>{const n=Math.floor(e/3600),t=Math.floor(e%3600/60),s=e%60;if(n===0&&t===0)return`(${s.toFixed(1)} seconds)`;if(n===0){const p=`${t} minute${t===1?"":"s"}`,d=s===0?"":`, ${s.toFixed(1)} seconds`;return`(${p}${d})`}const l=`${n} hour${n===1?"":"s"}`,i=t===0?"":`, ${t} minute${t===1?"":"s"}`,r=s===0?"":`, ${s.toFixed(1)} seconds`;return`(${l}${i}${r})`};function w({element:e}){const{cache:n,showTime:t}=e,[s,l]=a.useState(0),i=a.useRef(null);return a.useEffect(()=>{if(!t)return;i.current=Date.now();const r=()=>{if(i.current!==null){const m=(Date.now()-i.current)/1e3;l(m)}};r();const p=setInterval(r,100);return()=>clearInterval(p)},[t]),o(x,{className:g({stSpinner:!0,stCacheSpinner:n}),"data-testid":"stSpinner",cache:n,children:u(T,{children:[o(f,{size:"lg",iconValue:"spinner"}),u($,{children:[o(S,{source:e.text,allowHTML:!1}),t&&o(h,{children:y(s)})]})]})})}const v=a.memo(w);export{v as default};
@@ -1 +1 @@
1
- import{z as c,ah as e,c as t,r as n,B as l,j as a,u as C,a as x,D as L,d as S}from"./index.CPc_uZux.js";import{m as $}from"./iconPosition.BVScIr6G.js";function R(o,r){switch(o){case t.XSMALL:return{padding:`${r.spacing.twoXS} ${r.spacing.sm}`,fontSize:r.fontSizes.sm};case t.SMALL:return{padding:`${r.spacing.twoXS} ${r.spacing.md}`};case t.LARGE:return{padding:`${r.spacing.md} ${r.spacing.md}`};default:return{padding:`${r.spacing.xs} ${r.spacing.md}`}}}const f=c("a",{target:"e1hofpsd0"})(({containerWidth:o,size:r,theme:i})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:i.fontWeights.normal,padding:`${i.spacing.xs} ${i.spacing.md}`,borderRadius:i.radii.button,minHeight:i.sizes.minElementHeight,margin:0,lineHeight:i.lineHeights.base,color:i.colors.primary,textDecoration:"none",width:o?"100%":"auto",userSelect:"none","&:visited":{color:i.colors.primary},"&:focus":{outline:"none"},"&:focus-visible":{boxShadow:i.shadows.focusRing},"&:hover":{textDecoration:"none"},"&:active":{textDecoration:"none"},...R(r,i)})),T=c(f,{target:"e1hofpsd1"})(({theme:o})=>({backgroundColor:o.colors.primary,color:o.colors.white,border:`${o.sizes.borderWidth} solid ${o.colors.primary}`,"&:hover, &:focus-visible":{backgroundColor:e(o.colors.primary,.15),borderColor:e(o.colors.primary,.15)},"&:active":{backgroundColor:o.colors.primary,borderColor:e(o.colors.primary,.15)},"&:visited:not(:active)":{color:o.colors.white},"&[disabled], &[disabled]:hover, &[disabled]:active, &[disabled]:visited":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),w=c(f,{target:"e1hofpsd2"})(({theme:o})=>({backgroundColor:o.colors.lightenedBg05,color:o.colors.bodyText,border:`${o.sizes.borderWidth} solid ${o.colors.borderColor}`,"&:visited":{color:o.colors.bodyText},"&:hover, &:focus-visible":{backgroundColor:o.colors.darkenedBgMix15},"&:active":{backgroundColor:o.colors.darkenedBgMix25},"&[disabled], &[disabled]:hover, &[disabled]:active":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),z=c(f,{target:"e1hofpsd3"})(({theme:o})=>({padding:o.spacing.none,backgroundColor:o.colors.transparent,color:o.colors.bodyText,border:"none","&:visited":{color:o.colors.bodyText},"&:hover, &:focus-visible":{color:o.colors.primary},"&:hover:not([disabled]), &:focus-visible:not([disabled])":{"span.stMarkdownColoredText":{color:"inherit !important"}},"&:active":{color:e(o.colors.primary,.25)},"&[disabled], &[disabled]:hover, &[disabled]:active":{backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),y=n.forwardRef(function({kind:r,size:i,disabled:s,children:d,autoFocus:u,href:b,rel:p,target:k,onClick:B},v){let g=T;return r===l.SECONDARY?g=w:r===l.TERTIARY&&(g=z),a(g,{ref:v,kind:r,size:i||t.MEDIUM,containerWidth:!0,disabled:s||!1,autoFocus:u||!1,href:b,target:k,rel:p,onClick:B,tabIndex:s?-1:0,"data-testid":`stBaseLinkButton-${r}`,children:d})});y.displayName="BaseLinkButton";const A=n.memo(y);function D(o){const{element:r}=o,i=r.shortcut?r.shortcut:void 0;let s=l.SECONDARY;r.type==="primary"?s=l.PRIMARY:r.type==="tertiary"&&(s=l.TERTIARY);const d=n.useRef(null),u=n.useCallback(()=>{r.disabled||d.current?.click()},[r.disabled]),b=n.useCallback(p=>{r.disabled&&p.preventDefault()},[r.disabled]);return C({shortcut:i,disabled:r.disabled,onActivate:u}),a(S,{className:"stLinkButton","data-testid":"stLinkButton",children:a(x,{help:r.help,containerWidth:!0,children:a(A,{ref:d,kind:s,size:t.SMALL,disabled:r.disabled,onClick:b,href:r.url,target:"_blank",rel:"noreferrer","aria-disabled":r.disabled,children:a(L,{icon:r.icon,iconPosition:$(r.iconPosition),label:r.label,shortcut:i})})})})}const I=n.memo(D);export{I as default};
1
+ import{z as c,aj as e,c as t,r as n,B as l,j as a,u as C,a as x,D as L,d as S}from"./index.BHyzKS4e.js";import{m as $}from"./iconPosition.C47DkA-1.js";function R(o,r){switch(o){case t.XSMALL:return{padding:`${r.spacing.twoXS} ${r.spacing.sm}`,fontSize:r.fontSizes.sm};case t.SMALL:return{padding:`${r.spacing.twoXS} ${r.spacing.md}`};case t.LARGE:return{padding:`${r.spacing.md} ${r.spacing.md}`};default:return{padding:`${r.spacing.xs} ${r.spacing.md}`}}}const f=c("a",{target:"e1hofpsd0"})(({containerWidth:o,size:r,theme:i})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:i.fontWeights.normal,padding:`${i.spacing.xs} ${i.spacing.md}`,borderRadius:i.radii.button,minHeight:i.sizes.minElementHeight,margin:0,lineHeight:i.lineHeights.base,color:i.colors.primary,textDecoration:"none",width:o?"100%":"auto",userSelect:"none","&:visited":{color:i.colors.primary},"&:focus":{outline:"none"},"&:focus-visible":{boxShadow:i.shadows.focusRing},"&:hover":{textDecoration:"none"},"&:active":{textDecoration:"none"},...R(r,i)})),T=c(f,{target:"e1hofpsd1"})(({theme:o})=>({backgroundColor:o.colors.primary,color:o.colors.white,border:`${o.sizes.borderWidth} solid ${o.colors.primary}`,"&:hover, &:focus-visible":{backgroundColor:e(o.colors.primary,.15),borderColor:e(o.colors.primary,.15)},"&:active":{backgroundColor:o.colors.primary,borderColor:e(o.colors.primary,.15)},"&:visited:not(:active)":{color:o.colors.white},"&[disabled], &[disabled]:hover, &[disabled]:active, &[disabled]:visited":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),w=c(f,{target:"e1hofpsd2"})(({theme:o})=>({backgroundColor:o.colors.lightenedBg05,color:o.colors.bodyText,border:`${o.sizes.borderWidth} solid ${o.colors.borderColor}`,"&:visited":{color:o.colors.bodyText},"&:hover, &:focus-visible":{backgroundColor:o.colors.darkenedBgMix15},"&:active":{backgroundColor:o.colors.darkenedBgMix25},"&[disabled], &[disabled]:hover, &[disabled]:active":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),z=c(f,{target:"e1hofpsd3"})(({theme:o})=>({padding:o.spacing.none,backgroundColor:o.colors.transparent,color:o.colors.bodyText,border:"none","&:visited":{color:o.colors.bodyText},"&:hover, &:focus-visible":{color:o.colors.primary},"&:hover:not([disabled]), &:focus-visible:not([disabled])":{"span.stMarkdownColoredText":{color:"inherit !important"}},"&:active":{color:e(o.colors.primary,.25)},"&[disabled], &[disabled]:hover, &[disabled]:active":{backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),y=n.forwardRef(function({kind:r,size:i,disabled:s,children:d,autoFocus:u,href:b,rel:p,target:k,onClick:B},v){let g=T;return r===l.SECONDARY?g=w:r===l.TERTIARY&&(g=z),a(g,{ref:v,kind:r,size:i||t.MEDIUM,containerWidth:!0,disabled:s||!1,autoFocus:u||!1,href:b,target:k,rel:p,onClick:B,tabIndex:s?-1:0,"data-testid":`stBaseLinkButton-${r}`,children:d})});y.displayName="BaseLinkButton";const A=n.memo(y);function D(o){const{element:r}=o,i=r.shortcut?r.shortcut:void 0;let s=l.SECONDARY;r.type==="primary"?s=l.PRIMARY:r.type==="tertiary"&&(s=l.TERTIARY);const d=n.useRef(null),u=n.useCallback(()=>{r.disabled||d.current?.click()},[r.disabled]),b=n.useCallback(p=>{r.disabled&&p.preventDefault()},[r.disabled]);return C({shortcut:i,disabled:r.disabled,onActivate:u}),a(S,{className:"stLinkButton","data-testid":"stLinkButton",children:a(x,{help:r.help,containerWidth:!0,children:a(A,{ref:d,kind:s,size:t.SMALL,disabled:r.disabled,onClick:b,href:r.url,target:"_blank",rel:"noreferrer","aria-disabled":r.disabled,children:a(L,{icon:r.icon,iconPosition:$(r.iconPosition),label:r.label,shortcut:i})})})})}const I=n.memo(D);export{I as default};
@@ -1 +1 @@
1
- import{aR as L,aS as E,aT as O,aU as A,z as B,r as n,l as H,az as k,aV as N,j as h,aW as $,o as F,p as D,ab as P,ac as U,aX as Y,aY as j,av as K,aZ as X,ae as Z}from"./index.CPc_uZux.js";import{u as _}from"./useBasicWidgetState.DvpdEDYZ.js";import{a as q}from"./_arrayIncludes.B19Iyn2B.js";import"./FormClearHelper.DTFnX0js.js";import"./_baseIndexOf.BTknn6Gb.js";var G=200;function J(o,t,d,u){var e=-1,m=q,l=!0,p=o.length,s=[],f=t.length;if(!p)return s;t.length>=G&&(m=E,l=!1,t=new L(t));e:for(;++e<p;){var i=o[e],c=i;if(i=i!==0?i:0,l&&c===c){for(var g=f;g--;)if(t[g]===c)continue e;s.push(i)}else m(t,c,u)||s.push(i)}return s}var Q=O(function(o,t){return A(o)?J(o,t):[]});const ee=B("div",{target:"ekqzr6e0"})(({theme:o})=>({"span[aria-disabled='true']":{background:o.colors.fadedText05}})),te=(o,t)=>o.getStringArrayValue(t),oe=o=>o.default.map(t=>o.options[t])??null,re=o=>o.rawValues??null,se=(o,t,d,u)=>{t.setStringArrayValue(o,d.value,{fromUi:d.fromUi},u)},ne=o=>{const{element:t,widgetMgr:d,fragmentId:u}=o,e=H(),m=n.useContext(k),l=n.useRef(null),p=n.useRef(0),[s,f]=_({getStateFromWidgetMgr:te,getDefaultStateFromProto:oe,getCurrStateFromProto:re,updateWidgetMgrState:se,element:t,widgetMgr:d,fragmentId:u}),i=t.maxSelections>0&&s.length>=t.maxSelections,c=n.useMemo(()=>{if(t.maxSelections===0)return"No results";if(s.length===t.maxSelections){const r=t.maxSelections!==1?"options":"option";return`You can only select up to ${t.maxSelections} ${r}. Remove an option first.`}return"No results"},[t.maxSelections,s.length]),g=n.useCallback(r=>{switch(r.type){case"remove":return Q(s,r.option?.value);case"clear":return[];case"select":return s.concat([r.option?.value]);default:throw new Error(`State transition is unknown: ${r.type}`)}},[s]),C=n.useCallback(r=>{t.maxSelections&&r.type==="select"&&s.length>=t.maxSelections||f({value:g(r),fromUi:!0})},[t.maxSelections,g,f,s.length]),{options:v}=t,{placeholder:R,disabled:z,selectOptions:w,inputReadOnly:T,valuesToUiMulti:b,createFilterOptions:y}=N({options:v,isMulti:!0,acceptNewOptions:t.acceptNewOptions??!1,placeholderInput:t.placeholder}),M=n.useCallback((r,a)=>i?[]:y(s)(r,a),[y,i,s]),S=o.disabled||z,W=n.useMemo(()=>b(s),[b,s]),V=n.useMemo(()=>{const r=e.fontSizes.baseFontSize*1.6+14;return`${Math.round(r*4.25)}px`},[e.fontSizes.baseFontSize]);n.useLayoutEffect(()=>{l.current&&(l.current.scrollTop=p.current)});const x=n.useCallback(r=>{p.current=r.currentTarget.scrollTop},[]),I=n.useMemo(()=>(function(a){return h($,{...a,ref:l,onScroll:x})}),[x]);return F("div",{className:"stMultiSelect","data-testid":"stMultiSelect",children:[h(U,{label:t.label,disabled:S,labelVisibility:D(t.labelVisibility?.value),children:t.help&&h(P,{content:t.help,label:t.label})}),h(ee,{children:h(Y,{creatable:t.acceptNewOptions??!1,options:w,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:R,type:X.select,multi:!0,onChange:C,value:W,disabled:S,size:"compact",noResultsMsg:c,filterOptions:M,closeOnSelect:!1,ignoreCase:!1,overrides:{Popover:{props:{ignoreBoundary:m,overrides:{Body:{style:()=>({marginTop:e.spacing.px})}}}},SelectArrow:{component:K,props:{style:{cursor:"pointer"},overrides:{Svg:{style:()=>({width:e.iconSizes.xl,height:e.iconSizes.xl})}}}},IconsContainer:{style:()=>({paddingRight:e.spacing.sm})},ControlContainer:{style:({$isFocused:r})=>{const a=Z(e.colors,r);return{maxHeight:V,minHeight:e.sizes.minElementHeight,borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth,borderTopColor:a,borderRightColor:a,borderBottomColor:a,borderLeftColor:a}}},Placeholder:{style:()=>({flex:"inherit",color:S?e.colors.fadedText40:e.colors.fadedText60})},ValueContainer:{component:I,style:()=>({overflowY:"auto",paddingLeft:e.spacing.sm,paddingTop:e.spacing.none,paddingBottom:e.spacing.none,paddingRight:e.spacing.none})},ClearIcon:{props:{overrides:{Svg:{style:{color:e.colors.grayTextColor,padding:e.spacing.threeXS,height:e.sizes.clearIconSize,width:e.sizes.clearIconSize,cursor:"pointer",":hover":{fill:e.colors.bodyText}}}}}},SearchIcon:{style:{color:e.colors.grayTextColor}},Tag:{props:{overrides:{Root:{style:{fontWeight:e.fontWeights.normal,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:T}},Dropdown:{component:j}}})})]})},ue=n.memo(ne);export{ue as default};
1
+ import{a_ as L,a$ as B,b0 as E,b1 as O,z as A,r as n,l as H,aB as $,b2 as k,j as h,b3 as N,o as F,p as D,ad as P,ae as U,b4 as j,b5 as Y,ax as _,b6 as K,ag as q}from"./index.BHyzKS4e.js";import{u as G}from"./useBasicWidgetState.BXKaD8DQ.js";import{a as X}from"./_arrayIncludes.B19Iyn2B.js";import"./FormClearHelper.DQoXcOWo.js";import"./_baseIndexOf.BTknn6Gb.js";var Z=200;function J(o,t,d,u){var e=-1,m=X,l=!0,p=o.length,s=[],f=t.length;if(!p)return s;t.length>=Z&&(m=B,l=!1,t=new L(t));e:for(;++e<p;){var i=o[e],c=i;if(i=i!==0?i:0,l&&c===c){for(var g=f;g--;)if(t[g]===c)continue e;s.push(i)}else m(t,c,u)||s.push(i)}return s}var Q=E(function(o,t){return O(o)?J(o,t):[]});const ee=A("div",{target:"ekqzr6e0"})(({theme:o})=>({"span[aria-disabled='true']":{background:o.colors.fadedText05}})),te=(o,t)=>o.getStringArrayValue(t),oe=o=>o.default.map(t=>o.options[t])??null,re=o=>o.rawValues??null,se=(o,t,d,u)=>{t.setStringArrayValue(o,d.value,{fromUi:d.fromUi},u)},ne=o=>{const{element:t,widgetMgr:d,fragmentId:u}=o,e=H(),m=n.useContext($),l=n.useRef(null),p=n.useRef(0),[s,f]=G({getStateFromWidgetMgr:te,getDefaultStateFromProto:oe,getCurrStateFromProto:re,updateWidgetMgrState:se,element:t,widgetMgr:d,fragmentId:u}),i=t.maxSelections>0&&s.length>=t.maxSelections,c=n.useMemo(()=>{if(t.maxSelections===0)return"No results";if(s.length===t.maxSelections){const r=t.maxSelections!==1?"options":"option";return`You can only select up to ${t.maxSelections} ${r}. Remove an option first.`}return"No results"},[t.maxSelections,s.length]),g=n.useCallback(r=>{switch(r.type){case"remove":return Q(s,r.option?.value);case"clear":return[];case"select":return s.concat([r.option?.value]);default:throw new Error(`State transition is unknown: ${r.type}`)}},[s]),C=n.useCallback(r=>{t.maxSelections&&r.type==="select"&&s.length>=t.maxSelections||f({value:g(r),fromUi:!0})},[t.maxSelections,g,f,s.length]),{options:v}=t,{placeholder:R,disabled:z,selectOptions:w,inputReadOnly:T,valuesToUiMulti:S,createFilterOptions:x}=k({options:v,isMulti:!0,acceptNewOptions:t.acceptNewOptions??!1,placeholderInput:t.placeholder}),M=n.useCallback((r,a)=>i?[]:x(s)(r,a),[x,i,s]),b=o.disabled||z,W=n.useMemo(()=>S(s),[S,s]),V=n.useMemo(()=>{const r=e.fontSizes.baseFontSize*1.6+14;return`${Math.round(r*4.25)}px`},[e.fontSizes.baseFontSize]);n.useLayoutEffect(()=>{l.current&&(l.current.scrollTop=p.current)});const y=n.useCallback(r=>{p.current=r.currentTarget.scrollTop},[]),I=n.useMemo(()=>(function(a){return h(N,{...a,ref:l,onScroll:y})}),[y]);return F("div",{className:"stMultiSelect","data-testid":"stMultiSelect",children:[h(U,{label:t.label,disabled:b,labelVisibility:D(t.labelVisibility?.value),children:t.help&&h(P,{content:t.help,label:t.label})}),h(ee,{children:h(j,{creatable:t.acceptNewOptions??!1,options:w,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:R,type:K.select,multi:!0,onChange:C,value:W,disabled:b,size:"compact",noResultsMsg:c,filterOptions:M,closeOnSelect:!1,ignoreCase:!1,overrides:{Popover:{props:{ignoreBoundary:m,overrides:{Body:{style:()=>({marginTop:e.spacing.px})}}}},SelectArrow:{component:_,props:{style:{cursor:"pointer"},overrides:{Svg:{style:()=>({width:e.iconSizes.xl,height:e.iconSizes.xl})}}}},IconsContainer:{style:()=>({paddingRight:e.spacing.sm})},ControlContainer:{style:({$isFocused:r})=>{const a=q(e.colors,r);return{maxHeight:V,minHeight:e.sizes.minElementHeight,borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth,borderTopColor:a,borderRightColor:a,borderBottomColor:a,borderLeftColor:a}}},Placeholder:{style:()=>({flex:"inherit",color:b?e.colors.fadedText40:e.colors.fadedText60})},ValueContainer:{component:I,style:()=>({overflowY:"auto",paddingLeft:e.spacing.sm,paddingTop:e.spacing.none,paddingBottom:e.spacing.none,paddingRight:e.spacing.none})},ClearIcon:{props:{overrides:{Svg:{style:{color:e.colors.grayTextColor,padding:e.spacing.threeXS,height:e.sizes.clearIconSize,width:e.sizes.clearIconSize,cursor:"pointer",":hover":{fill:e.colors.bodyText}}}}}},SearchIcon:{style:{color:e.colors.grayTextColor}},Tag:{props:{overrides:{Root:{style:{fontWeight:e.fontWeights.normal,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:T}},Dropdown:{component:Y}}})})]})},ue=n.memo(ne);export{ue as default};