streamlit 1.48.1__py3-none-any.whl → 1.49.1__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 (203) hide show
  1. streamlit/__init__.py +3 -10
  2. streamlit/commands/logo.py +4 -3
  3. streamlit/commands/navigation.py +1 -1
  4. streamlit/commands/page_config.py +4 -1
  5. streamlit/components/v1/custom_component.py +2 -2
  6. streamlit/config.py +82 -1
  7. streamlit/connections/snowflake_connection.py +3 -1
  8. streamlit/delta_generator.py +3 -0
  9. streamlit/elements/arrow.py +155 -70
  10. streamlit/elements/bokeh_chart.py +13 -3
  11. streamlit/elements/deck_gl_json_chart.py +0 -1
  12. streamlit/elements/dialog_decorator.py +7 -59
  13. streamlit/elements/form.py +10 -1
  14. streamlit/elements/graphviz_chart.py +57 -6
  15. streamlit/elements/heading.py +17 -16
  16. streamlit/elements/image.py +64 -37
  17. streamlit/elements/layouts.py +2 -2
  18. streamlit/elements/lib/built_in_chart_utils.py +2 -5
  19. streamlit/elements/lib/column_config_utils.py +18 -4
  20. streamlit/elements/lib/column_types.py +75 -30
  21. streamlit/elements/lib/dialog.py +3 -3
  22. streamlit/elements/lib/image_utils.py +19 -11
  23. streamlit/elements/lib/layout_utils.py +19 -6
  24. streamlit/elements/lib/utils.py +20 -41
  25. streamlit/elements/markdown.py +7 -6
  26. streamlit/elements/media.py +6 -13
  27. streamlit/elements/metric.py +78 -1
  28. streamlit/elements/pdf.py +192 -0
  29. streamlit/elements/plotly_chart.py +3 -2
  30. streamlit/elements/pyplot.py +53 -11
  31. streamlit/elements/toast.py +81 -5
  32. streamlit/elements/vega_charts.py +3 -8
  33. streamlit/elements/widgets/audio_input.py +0 -1
  34. streamlit/elements/widgets/button.py +0 -4
  35. streamlit/elements/widgets/button_group.py +5 -4
  36. streamlit/elements/widgets/camera_input.py +0 -1
  37. streamlit/elements/widgets/chat.py +11 -13
  38. streamlit/elements/widgets/checkbox.py +0 -1
  39. streamlit/elements/widgets/color_picker.py +0 -1
  40. streamlit/elements/widgets/data_editor.py +142 -62
  41. streamlit/elements/widgets/file_uploader.py +74 -37
  42. streamlit/elements/widgets/multiselect.py +0 -1
  43. streamlit/elements/widgets/number_input.py +0 -1
  44. streamlit/elements/widgets/radio.py +0 -1
  45. streamlit/elements/widgets/select_slider.py +0 -1
  46. streamlit/elements/widgets/selectbox.py +0 -1
  47. streamlit/elements/widgets/slider.py +0 -1
  48. streamlit/elements/widgets/text_widgets.py +0 -2
  49. streamlit/elements/widgets/time_widgets.py +0 -2
  50. streamlit/errors.py +11 -0
  51. streamlit/material_icon_names.py +1 -1
  52. streamlit/proto/Arrow_pb2.py +14 -8
  53. streamlit/proto/Arrow_pb2.pyi +11 -3
  54. streamlit/proto/Block_pb2.py +16 -16
  55. streamlit/proto/Block_pb2.pyi +2 -0
  56. streamlit/proto/ChatInput_pb2.py +3 -3
  57. streamlit/proto/ChatInput_pb2.pyi +2 -0
  58. streamlit/proto/FileUploader_pb2.py +2 -2
  59. streamlit/proto/FileUploader_pb2.pyi +5 -1
  60. streamlit/proto/GraphVizChart_pb2.py +4 -2
  61. streamlit/proto/GraphVizChart_pb2.pyi +1 -1
  62. streamlit/proto/Image_pb2.py +4 -2
  63. streamlit/proto/Image_pb2.pyi +1 -10
  64. streamlit/proto/Metric_pb2.py +8 -6
  65. streamlit/proto/Metric_pb2.pyi +34 -10
  66. streamlit/proto/Toast_pb2.py +2 -2
  67. streamlit/proto/Toast_pb2.pyi +10 -1
  68. streamlit/runtime/caching/__init__.py +14 -2
  69. streamlit/runtime/caching/cache_data_api.py +0 -17
  70. streamlit/runtime/caching/cache_resource_api.py +0 -16
  71. streamlit/runtime/caching/cached_message_replay.py +8 -20
  72. streamlit/runtime/caching/hashing.py +31 -1
  73. streamlit/runtime/credentials.py +4 -4
  74. streamlit/runtime/fragment.py +0 -42
  75. streamlit/runtime/websocket_session_manager.py +1 -1
  76. streamlit/static/index.html +2 -2
  77. streamlit/static/manifest.json +223 -251
  78. streamlit/static/static/css/{index.CJVRHjQZ.css → index.C8X8rNzw.css} +1 -1
  79. streamlit/static/static/css/index.COe1010n.css +1 -0
  80. streamlit/static/static/js/{ErrorOutline.esm.DjObtx4K.js → ErrorOutline.esm.DcGrhbBP.js} +1 -1
  81. streamlit/static/static/js/{FileDownload.esm.Bz9nxNC5.js → FileDownload.esm.DgBvV6Pq.js} +1 -1
  82. streamlit/static/static/js/FileHelper.M6AAaeuA.js +5 -0
  83. streamlit/static/static/js/FormClearHelper.DHh1GFzm.js +1 -0
  84. streamlit/static/static/js/{Hooks.DEoLCfOE.js → Hooks.DGu1od_L.js} +1 -1
  85. streamlit/static/static/js/InputInstructions.z6sVgyYt.js +1 -0
  86. streamlit/static/static/js/Particles.DDVT-6Qc.js +1 -0
  87. streamlit/static/static/js/ProgressBar.BEY0cXXV.js +2 -0
  88. streamlit/static/static/js/Toolbar.DSnK1fUh.js +1 -0
  89. streamlit/static/static/js/{base-input.BmvSaPd2.js → base-input.CK3UVGp1.js} +4 -4
  90. streamlit/static/static/js/{checkbox.Cgxgc0et.js → checkbox.D8W881TL.js} +2 -2
  91. streamlit/static/static/js/createSuper.B6W-Dh9S.js +1 -0
  92. streamlit/static/static/js/data-grid-overlay-editor.DRTHOydk.js +1 -0
  93. streamlit/static/static/js/{downloader.M6jQeNDf.js → downloader.DiKpuU_S.js} +1 -1
  94. streamlit/static/static/js/es6.B8zRNPZ-.js +2 -0
  95. streamlit/static/static/js/iframeResizer.contentWindow.DIewJmmh.js +1 -0
  96. streamlit/static/static/js/index.452cqrrL.js +1 -0
  97. streamlit/static/static/js/index.4eF4NxG2.js +1 -0
  98. streamlit/static/static/js/index.B6U8LQo3.js +1 -0
  99. streamlit/static/static/js/index.B9mjBcgE.js +1 -0
  100. streamlit/static/static/js/index.BXYmrqnf.js +1 -0
  101. streamlit/static/static/js/index.B_8AnktO.js +1 -0
  102. streamlit/static/static/js/index.Bl7zGQSh.js +7 -0
  103. streamlit/static/static/js/index.BnEpvLEz.js +1 -0
  104. streamlit/static/static/js/{index.D1EayrNh.js → index.BnJIOYn9.js} +2 -2
  105. streamlit/static/static/js/index.Bte_9Lyq.js +1 -0
  106. streamlit/static/static/js/index.C1HcTl5K.js +1 -0
  107. streamlit/static/static/js/index.C7fRKRs4.js +1 -0
  108. streamlit/static/static/js/index.C7lSmSOP.js +1 -0
  109. streamlit/static/static/js/index.CD8HuT3N.js +976 -0
  110. streamlit/static/static/js/index.CP5TD2z1.js +1 -0
  111. streamlit/static/static/js/index.C_tmcx4B.js +1 -0
  112. streamlit/static/static/js/index.CcJf6BCU.js +3858 -0
  113. streamlit/static/static/js/{index.CbdWnLqS.js → index.CejBxbg1.js} +3 -3
  114. streamlit/static/static/js/index.Ch7MBCx0.js +5367 -0
  115. streamlit/static/static/js/index.CjXWwH-y.js +1 -0
  116. streamlit/static/static/js/index.CvYYtxD_.js +1 -0
  117. streamlit/static/static/js/index.D2-atlaQ.js +3 -0
  118. streamlit/static/static/js/index.D3K5nOu9.js +197 -0
  119. streamlit/static/static/js/index.D5naqx-J.js +1 -0
  120. streamlit/static/static/js/index.Dk4C7X3i.js +1 -0
  121. streamlit/static/static/js/index.DkKT3LUI.js +1 -0
  122. streamlit/static/static/js/index.DtYN2x4k.js +1 -0
  123. streamlit/static/static/js/index.MTPPBDHk.js +2 -0
  124. streamlit/static/static/js/{index.Cqa4gqqN.js → index.Ts_0SdB9.js} +1 -1
  125. streamlit/static/static/js/{index.CgZDfhN4.js → index.cnnXF7xQ.js} +2 -2
  126. streamlit/static/static/js/index.ho6NIXGl.js +1 -0
  127. streamlit/static/static/js/index.pqW9AMJD.js +3 -0
  128. streamlit/static/static/js/{index.D1jHqUJq.js → index.qhs54UAB.js} +1 -1
  129. streamlit/static/static/js/{index.tsvTLdio.js → index.urHgTgMQ.js} +9 -9
  130. streamlit/static/static/js/index.wzkv_11M.js +1 -0
  131. streamlit/static/static/js/index.yF5AncHY.js +1 -0
  132. streamlit/static/static/js/{index.BXDq9dj4.js → index.zecpGxtj.js} +1 -1
  133. streamlit/static/static/js/{input.DZd6EQlV.js → input.nzVJphXi.js} +2 -2
  134. streamlit/static/static/js/{memory.ptkfuI71.js → memory.CjCgTQz3.js} +1 -1
  135. streamlit/static/static/js/number-overlay-editor.DaRFzZEO.js +9 -0
  136. streamlit/static/static/js/{possibleConstructorReturn.Bd4ImlQ9.js → possibleConstructorReturn.DgiPnZ9N.js} +1 -1
  137. streamlit/static/static/js/{sandbox.DsH8LuID.js → sandbox.mithfq7Z.js} +1 -1
  138. streamlit/static/static/js/{timepicker.QVekV78C.js → timepicker.Dbl5KFh6.js} +4 -4
  139. streamlit/static/static/js/{toConsumableArray.BJvaP8gb.js → toConsumableArray.D-Dx88BQ.js} +3 -3
  140. streamlit/static/static/js/uniqueId.Bh26R_3S.js +1 -0
  141. streamlit/static/static/js/{useBasicWidgetState.DB3vMS9V.js → useBasicWidgetState.DeK-QJpD.js} +1 -1
  142. streamlit/static/static/js/{useTextInputAutoExpand.CBkGkaRt.js → useTextInputAutoExpand.4iAdLWD-.js} +2 -2
  143. streamlit/static/static/js/useUpdateUiValue.CmT7_nJN.js +1 -0
  144. streamlit/static/static/js/withFullScreenWrapper.DLp1ENGm.js +1 -0
  145. streamlit/static/static/media/MaterialSymbols-Rounded.CBxVaFdk.woff2 +0 -0
  146. streamlit/user_info.py +3 -1
  147. streamlit/web/server/browser_websocket_handler.py +15 -0
  148. {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/METADATA +4 -2
  149. {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/RECORD +153 -156
  150. streamlit/static/static/css/index.CQt5TjGB.css +0 -1
  151. streamlit/static/static/js/FileHelper.BrQvUXVD.js +0 -5
  152. streamlit/static/static/js/FormClearHelper.DF4gFAOO.js +0 -1
  153. streamlit/static/static/js/InputInstructions.D8zoMog9.js +0 -1
  154. streamlit/static/static/js/Particles.CCFySwdL.js +0 -1
  155. streamlit/static/static/js/ProgressBar.COK9j1l0.js +0 -2
  156. streamlit/static/static/js/Toolbar.Dt4jIKlY.js +0 -1
  157. streamlit/static/static/js/createSuper.siQeagI2.js +0 -1
  158. streamlit/static/static/js/data-grid-overlay-editor.Ct51iCb_.js +0 -1
  159. streamlit/static/static/js/es6.CMaUdEZ5.js +0 -2
  160. streamlit/static/static/js/iframeResizer.contentWindow.C33BryyP.js +0 -1
  161. streamlit/static/static/js/index.8GJD0eeD.js +0 -1
  162. streamlit/static/static/js/index.8QEYHMQD.js +0 -1
  163. streamlit/static/static/js/index.Ay41Wnu9.js +0 -1
  164. streamlit/static/static/js/index.BLiKiJ7_.js +0 -1
  165. streamlit/static/static/js/index.BT78cJmU.js +0 -1
  166. streamlit/static/static/js/index.BdGvnhlM.js +0 -1
  167. streamlit/static/static/js/index.BfasrT0d.js +0 -1
  168. streamlit/static/static/js/index.CCdtFMFG.js +0 -1
  169. streamlit/static/static/js/index.CFRGZDz1.js +0 -1
  170. streamlit/static/static/js/index.CFSFYiPA.js +0 -5366
  171. streamlit/static/static/js/index.CeiIiXap.js +0 -1
  172. streamlit/static/static/js/index.CzX2xpyc.js +0 -1
  173. streamlit/static/static/js/index.D1ErX5go.js +0 -2
  174. streamlit/static/static/js/index.D5gweoL5.js +0 -7
  175. streamlit/static/static/js/index.DByVKZgq.js +0 -1
  176. streamlit/static/static/js/index.DEND45D1.js +0 -3
  177. streamlit/static/static/js/index.DKN5MVff.js +0 -781
  178. streamlit/static/static/js/index.DfoxW1gP.js +0 -3855
  179. streamlit/static/static/js/index.Dtf1Ac0x.js +0 -1
  180. streamlit/static/static/js/index.DxrLhpeO.js +0 -1
  181. streamlit/static/static/js/index.J7o-_HIh.js +0 -1
  182. streamlit/static/static/js/index.LU8juINp.js +0 -197
  183. streamlit/static/static/js/index.L_N2iylt.js +0 -1
  184. streamlit/static/static/js/index.PZUX2kRz.js +0 -3
  185. streamlit/static/static/js/index.ROjU6K0k.js +0 -1
  186. streamlit/static/static/js/index.WSNLkF94.js +0 -1
  187. streamlit/static/static/js/index.X5W3gJLn.js +0 -1
  188. streamlit/static/static/js/index.k9LYqfSL.js +0 -1
  189. streamlit/static/static/js/index.pnHtHv_c.js +0 -203
  190. streamlit/static/static/js/index.tPUXqsfW.js +0 -1
  191. streamlit/static/static/js/mergeWith.GRNk8iwv.js +0 -1
  192. streamlit/static/static/js/number-overlay-editor.DXS2qb1U.js +0 -9
  193. streamlit/static/static/js/threshold.DjX0wlsa.js +0 -1
  194. streamlit/static/static/js/timer.CAwTRJ_g.js +0 -1
  195. streamlit/static/static/js/uniqueId.D_5M8Dgf.js +0 -1
  196. streamlit/static/static/js/useUpdateUiValue.C7ZKpLQK.js +0 -1
  197. streamlit/static/static/js/value.CgPGBV_l.js +0 -1
  198. streamlit/static/static/js/withFullScreenWrapper.C-gXt0Rl.js +0 -1
  199. streamlit/static/static/media/MaterialSymbols-Rounded.DsbC8sYI.woff2 +0 -0
  200. {streamlit-1.48.1.data → streamlit-1.49.1.data}/scripts/streamlit.cmd +0 -0
  201. {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/WHEEL +0 -0
  202. {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/entry_points.txt +0 -0
  203. {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1 @@
1
+ import{r as o,L as h,B as i,j as e,a as k,b as g,c as R,D as C}from"./index.CD8HuT3N.js";import{c as L}from"./createDownloadLinkElement.ZaXNnPK4.js";function x(d){const{disabled:c,element:l,widgetMgr:u,endpoints:t,fragmentId:f}=d,{help:m,label:B,icon:w,ignoreRerun:D,type:s,url:r}=l,{libConfig:{enforceDownloadInNewTab:p=!1}}=o.useContext(h);let n=i.SECONDARY;s==="primary"?n=i.PRIMARY:s==="tertiary"&&(n=i.TERTIARY);const a=o.useMemo(()=>t.buildDownloadUrl(r),[t,r]);o.useEffect(()=>{t.checkSourceUrlResponse(a,"Download Button")},[a,t]);const b=()=>{D||u.setTriggerValue(l,{fromUi:!0},f),L({filename:"",url:a,enforceDownloadInNewTab:p}).click()};return e("div",{className:"stDownloadButton","data-testid":"stDownloadButton",children:e(k,{help:m,containerWidth:!0,children:e(g,{kind:n,size:R.SMALL,disabled:c,onClick:b,containerWidth:!0,children:e(C,{icon:w,label:B})})})})}const A=o.memo(x);export{A as default};
@@ -0,0 +1 @@
1
+ import{r as p,u as T,h as k,j as n,e as C,l as y,S,f as L,T as W,P as B,g as w,t as R,C as E,i as P}from"./index.CD8HuT3N.js";import{u as $}from"./useBasicWidgetState.DeK-QJpD.js";import{S as v,L as X,a as m}from"./checkbox.D8W881TL.js";import"./FormClearHelper.DHh1GFzm.js";function H({element:e,disabled:a,widgetMgr:s,fragmentId:d}){const[f,g]=$({getStateFromWidgetMgr:M,getDefaultStateFromProto:V,getCurrStateFromProto:I,updateWidgetMgrState:j,element:e,widgetMgr:s,fragmentId:d}),x=p.useCallback(i=>{g({value:i.target.checked,fromUi:!0})},[g]),t=T(),{colors:o,spacing:h,sizes:r}=t,u=k(t),b=a?o.fadedText40:o.bodyText;return n(P,{className:"row-widget stCheckbox","data-testid":"stCheckbox",children:n(v,{checked:f,disabled:a,onChange:x,"aria-label":e.label,checkmarkType:e.type===E.StyleType.TOGGLE?m.toggle:m.default,labelPlacement:X.right,overrides:{Root:{style:({$isFocusVisible:i})=>({marginBottom:h.none,marginTop:h.none,backgroundColor:i?o.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:i})=>{let c=u?o.bgColor:o.bodyText;return a&&(c=u?o.gray70:o.gray90),{width:`calc(${r.checkbox} - ${t.spacing.twoXS})`,height:`calc(${r.checkbox} - ${t.spacing.twoXS})`,transform:i?`translateX(${r.checkbox})`:"",backgroundColor:c,boxShadow:""}}},ToggleTrack:{style:({$checked:i,$isHovered:c})=>{let l=o.fadedText40;return c&&!a&&(l=o.fadedText20),i&&!a&&(l=o.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:t.spacing.twoXS,paddingLeft:t.spacing.threeXS,paddingRight:t.spacing.threeXS,width:`calc(2 * ${r.checkbox})`,minWidth:`calc(2 * ${r.checkbox})`,height:r.checkbox,minHeight:r.checkbox,borderBottomLeftRadius:t.radii.full,borderTopLeftRadius:t.radii.full,borderBottomRightRadius:t.radii.full,borderTopRightRadius:t.radii.full,backgroundColor:l}}},Checkmark:{style:({$isFocusVisible:i,$checked:c})=>{const l=c&&!a?o.primary:o.fadedText40;return{outline:0,width:r.checkbox,height:r.checkbox,marginTop:t.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:i&&c?`0 0 0 0.2rem ${R(o.primary,.5)}`:"",borderLeftWidth:r.borderWidth,borderRightWidth:r.borderWidth,borderTopWidth:r.borderWidth,borderBottomWidth:r.borderWidth,borderLeftColor:l,borderRightColor:l,borderTopColor:l,borderBottomColor:l}}},Label:{style:{lineHeight:t.lineHeights.small,paddingLeft:t.spacing.sm,position:"relative",color:b}}},children:C(w,{visibility:y(e.labelVisibility?.value),"data-testid":"stWidgetLabel",children:[n(S,{source:e.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),e.help&&n(L,{color:b,children:n(W,{content:e.help,placement:B.TOP_RIGHT})})]})})})}function M(e,a){return e.getBoolValue(a)}function V(e){return e.default??null}function I(e){return e.value??null}function j(e,a,s,d){a.setBoolValue(e,s.value,{fromUi:s.fromUi},d)}const z=p.memo(H);export{z as default};
@@ -0,0 +1 @@
1
+ import{v as i,a1 as m,r as c,j as n,ar as p}from"./index.CD8HuT3N.js";import{P as f,R as d}from"./Particles.DDVT-6Qc.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,L=""+new URL("../media/balloon-2.DTvC6B1t.png",import.meta.url).href,h=""+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,I=m("from{transform:translateY(calc(100vh + ",t,"px));}to{transform:translateY(0);}"),M=i("img",{target:"eosrfo90"})(({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:I,animationTimingFunction:"ease-in",animationDirection:"normal",animationIterationCount:1,opacity:1})),b=30,r=[g,B,L,h,u,x],w=r.length,E=({particleType:o,resourceCrossOriginMode:l})=>{const a=r[o];return n(M,{src:a,crossOrigin:p(l,a)})},N=({scriptRunId:o})=>n(d,{children:n(f,{className:"stBalloons","data-testid":"stBalloons",scriptRunId:o,numParticleTypes:w,numParticles:b,ParticleComponent:E})}),P=c.memo(N);export{b as NUM_BALLOONS,P as default};
@@ -0,0 +1 @@
1
+ import{v as f,r as e,u as w,e as x,j as a,y as m,S as L,z as r,F as R,h as C,o as k,K as z,G as B}from"./index.CD8HuT3N.js";const E=f("button",{target:"ee3yv4c0"})(({theme:o})=>({fontSize:o.fontSizes.sm,lineHeight:o.lineHeights.base,color:o.colors.fadedText60,backgroundColor:o.colors.transparent,fontFamily:"inherit",margin:o.spacing.none,border:"none",boxShadow:"none",padding:o.spacing.none,"&:hover, &:active, &:focus":{border:"none",outline:"none",boxShadow:"none"},"&:hover":{color:o.colors.primary}})),H=f("div",{target:"ee3yv4c1"})(({theme:o})=>({display:"flex",flexDirection:"row",gap:o.spacing.lg,"> span":{marginTop:o.spacing.twoXS}})),D=f("div",{target:"ee3yv4c2"})(({theme:o})=>({display:"flex",flexDirection:"column",gap:o.spacing.sm,alignItems:"start",justifyContent:"center",overflow:"hidden",minHeight:"100%",fontSize:o.fontSizes.sm,lineHeight:o.lineHeights.base,div:{display:"inline-flex"}}));function M(o){const t=C(o);return{Body:{props:{"data-testid":"stToast",className:"stToast"},style:{display:"flex",flexDirection:"row",gap:o.spacing.md,width:o.sizes.toastWidth,marginTop:o.spacing.sm,borderTopLeftRadius:o.radii.default,borderTopRightRadius:o.radii.default,borderBottomLeftRadius:o.radii.default,borderBottomRightRadius:o.radii.default,paddingTop:o.spacing.lg,paddingBottom:o.spacing.lg,paddingLeft:o.spacing.twoXL,paddingRight:o.spacing.twoXL,backgroundColor:o.colors.bgColor,filter:t?"brightness(0.98)":"brightness(1.2)",color:o.colors.bodyText,boxShadow:t?"0px 4px 16px rgba(0, 0, 0, 0.16)":"0px 4px 16px rgba(0, 0, 0, 0.7)"}},CloseIcon:{style:{color:o.colors.fadedText40,width:o.fontSizes.lg,height:o.fontSizes.lg,marginRight:`calc(-1 * ${o.spacing.lg} / 2)`,":hover":{color:o.colors.bodyText}}}}}function I(o){if(o.length>104){let s=o.replace(/^(.{104}[^\s]*).*/,"$1");return s.length>104&&(s=s.substring(0,104).split(" ").slice(0,-1).join(" ")),s.trim()}return o}function j({element:o}){const{body:t,icon:s,duration:d}=o,n=w(),c=I(t),l=t!==c,[i,S]=e.useState(!l),[y,T]=e.useState(0),b=e.useCallback(()=>{S(!i)},[i]),g=e.useMemo(()=>M(n),[n]),p=e.useMemo(()=>x(H,{expanded:i,children:[s&&a(m,{iconValue:s,size:"xl",testid:"stToastDynamicIcon"}),x(D,{children:[a(L,{source:i?t:c,allowHTML:!1,isToast:!0}),l&&a(E,{"data-testid":"stToastViewButton",onClick:b,children:i?"view less":"view more"})]})]}),[l,i,t,s,c,b]);e.useEffect(()=>{if(n.inSidebar)return;const v=k(d)?d===0?0:d*1e3:4e3,u=r.info(p,{overrides:{...g},autoHideDuration:v});return T(u),()=>{r.update(u,{overrides:{Body:{style:{display:"none"}}}}),r.clear(u)}},[]),e.useEffect(()=>{r.update(y,{children:p,overrides:{...g}})},[y,p,g]);const h=a(B,{kind:z.ERROR,body:"Streamlit API Error: `st.toast` cannot be called directly on the sidebar with `st.sidebar.toast`. See our `st.toast` API [docs](https://docs.streamlit.io/develop/api-reference/status/st.toast) for more information."});return a(R,{children:n.inSidebar&&h})}const O=e.memo(j);export{O as default};
@@ -0,0 +1,2 @@
1
+ import{b0 as Ke,ad as J,r as C,bq as gt,ae as pt,p as G,aH as vt,aI as mt,v as Xe,t as Fe,bg as bt,u as yt,br as Tt,j as ae,e as Ot,l as kt,R as wt,T as Rt,P as Mt,W as St,bs as _t,bt as _e}from"./index.CD8HuT3N.js";import{s as je}from"./sprintf.D7DtBTRn.js";import{u as $t}from"./useBasicWidgetState.DeK-QJpD.js";import"./FormClearHelper.DHh1GFzm.js";var se={},U={},ue={},ce={},ze;function $e(){if(ze)return ce;ze=1,Object.defineProperty(ce,"__esModule",{value:!0}),ce.Direction=void 0;var e;return function(r){r.Right="to right",r.Left="to left",r.Down="to bottom",r.Up="to top"}(e||(ce.Direction=e={})),ce}var Ve;function Ye(){return Ve||(Ve=1,function(e){var r=ue&&ue.__spreadArray||function(i,s,c){if(c||arguments.length===2)for(var b=0,R=s.length,p;b<R;b++)(p||!(b in s))&&(p||(p=Array.prototype.slice.call(s,0,b)),p[b]=s[b]);return i.concat(p||Array.prototype.slice.call(s))};Object.defineProperty(e,"__esModule",{value:!0}),e.isIOS=e.useThumbOverlap=e.assertUnreachable=e.voidFn=e.getTrackBackground=e.replaceAt=e.schd=e.translate=e.getClosestThumbIndex=e.translateThumbs=e.getPaddingAndBorder=e.getMargin=e.checkInitialOverlap=e.checkValuesAgainstBoundaries=e.checkBoundaries=e.isVertical=e.relativeValue=e.normalizeValue=e.isStepDivisible=e.isTouchEvent=e.getStepDecimals=void 0;var n=Ke(),o=$e(),g=function(i){var s=i.toString().split(".")[1];return s?s.length:0};e.getStepDecimals=g;function S(i){return i.touches&&i.touches.length||i.changedTouches&&i.changedTouches.length}e.isTouchEvent=S;function u(i,s,c){var b=(s-i)/c,R=8,p=Number(b.toFixed(R));return parseInt(p.toString(),10)===p}e.isStepDivisible=u;function f(i,s,c,b,R,p,O){var $=1e11;if(i=Math.round(i*$)/$,!p){var x=O[s-1],I=O[s+1];if(x&&x>i)return x;if(I&&I<i)return I}if(i>b)return b;if(i<c)return c;var N=Math.floor(i*$-c*$)%Math.floor(R*$),z=Math.floor(i*$-Math.abs(N)),q=N===0?i:z/$,P=Math.abs(N/$)<R/2?q:q+R,A=(0,e.getStepDecimals)(R);return parseFloat(P.toFixed(A))}e.normalizeValue=f;function j(i,s,c){return(i-s)/(c-s)}e.relativeValue=j;function F(i){return i===o.Direction.Up||i===o.Direction.Down}e.isVertical=F;function B(i,s,c){if(s>=c)throw new RangeError("min (".concat(s,") is equal/bigger than max (").concat(c,")"));if(i<s)throw new RangeError("value (".concat(i,") is smaller than min (").concat(s,")"));if(i>c)throw new RangeError("value (".concat(i,") is bigger than max (").concat(c,")"))}e.checkBoundaries=B;function M(i,s,c){return i<s?s:i>c?c:i}e.checkValuesAgainstBoundaries=M;function y(i){if(!(i.length<2)&&!i.slice(1).every(function(s,c){return i[c]<=s}))throw new RangeError("values={[".concat(i,"]} needs to be sorted when allowOverlap={false}"))}e.checkInitialOverlap=y;function d(i){var s=window.getComputedStyle(i);return{top:parseInt(s["margin-top"],10),bottom:parseInt(s["margin-bottom"],10),left:parseInt(s["margin-left"],10),right:parseInt(s["margin-right"],10)}}e.getMargin=d;function t(i){var s=window.getComputedStyle(i);return{top:parseInt(s["padding-top"],10)+parseInt(s["border-top-width"],10),bottom:parseInt(s["padding-bottom"],10)+parseInt(s["border-bottom-width"],10),left:parseInt(s["padding-left"],10)+parseInt(s["border-left-width"],10),right:parseInt(s["padding-right"],10)+parseInt(s["border-right-width"],10)}}e.getPaddingAndBorder=t;function a(i,s,c){var b=c?-1:1;i.forEach(function(R,p){return v(R,b*s[p].x,s[p].y)})}e.translateThumbs=a;function l(i,s,c,b){for(var R=0,p=L(i[0],s,c,b),O=1;O<i.length;O++){var $=L(i[O],s,c,b);$<p&&(p=$,R=O)}return R}e.getClosestThumbIndex=l;function v(i,s,c){i.style.transform="translate(".concat(s,"px, ").concat(c,"px)")}e.translate=v;var h=function(i){var s=[],c=null,b=function(){for(var R=[],p=0;p<arguments.length;p++)R[p]=arguments[p];s=R,!c&&(c=requestAnimationFrame(function(){c=null,i.apply(void 0,s)}))};return b};e.schd=h;function m(i,s,c){var b=i.slice(0);return b[s]=c,b}e.replaceAt=m;function E(i){var s=i.values,c=i.colors,b=i.min,R=i.max,p=i.direction,O=p===void 0?o.Direction.Right:p,$=i.rtl,x=$===void 0?!1:$;x&&O===o.Direction.Right?O=o.Direction.Left:x&&o.Direction.Left&&(O=o.Direction.Right);var I=s.slice(0).sort(function(z,q){return z-q}).map(function(z){return(z-b)/(R-b)*100}),N=I.reduce(function(z,q,P){return"".concat(z,", ").concat(c[P]," ").concat(q,"%, ").concat(c[P+1]," ").concat(q,"%")},"");return"linear-gradient(".concat(O,", ").concat(c[0]," 0%").concat(N,", ").concat(c[c.length-1]," 100%)")}e.getTrackBackground=E;function k(){}e.voidFn=k;function T(i){throw new Error("Didn't expect to get here")}e.assertUnreachable=T;var w=function(i,s,c,b,R){R===void 0&&(R=function(O){return O});var p=Math.ceil(r([i],Array.from(i.children),!0).reduce(function(O,$){var x=Math.ceil($.getBoundingClientRect().width);if($.innerText&&$.innerText.includes(c)&&$.childElementCount===0){var I=$.cloneNode(!0);I.innerHTML=R(s.toFixed(b)),I.style.visibility="hidden",document.body.appendChild(I),x=Math.ceil(I.getBoundingClientRect().width),document.body.removeChild(I)}return x>O?x:O},i.getBoundingClientRect().width));return p},D=function(i,s,c,b,R,p,O){O===void 0&&(O=function(I){return I});var $=[],x=function(I){var N=w(c[I],b[I],R,p,O),z=s[I].x;s.forEach(function(q,P){var A=q.x,Z=w(c[P],b[P],R,p,O);I!==P&&(z>=A&&z<=A+Z||z+N>=A&&z+N<=A+Z)&&($.includes(P)||($.push(I),$.push(P),$=r(r([],$,!0),[I,P],!1),x(P)))})};return x(i),Array.from(new Set($.sort()))},_=function(i,s,c,b,R,p){b===void 0&&(b=.1),R===void 0&&(R=" - "),p===void 0&&(p=function(P){return P});var O=(0,e.getStepDecimals)(b),$=(0,n.useState)({}),x=$[0],I=$[1],N=(0,n.useState)(p(s[c].toFixed(O))),z=N[0],q=N[1];return(0,n.useEffect)(function(){if(i){var P=i.getThumbs();if(P.length<1)return;var A={},Z=i.getOffsets(),re=D(c,Z,P,s,R,O,p),le=p(s[c].toFixed(O));if(re.length){var Q=re.reduce(function(ee,oe,ge,pe){return ee.length?r(r([],ee,!0),[Z[pe[ge]].x],!1):[Z[pe[ge]].x]},[]);if(Math.min.apply(Math,Q)===Z[c].x){var de=[];re.forEach(function(ee){de.push(s[ee].toFixed(O))}),le=Array.from(new Set(de.sort(function(ee,oe){return parseFloat(ee)-parseFloat(oe)}))).map(p).join(R);var fe=Math.min.apply(Math,Q),he=Math.max.apply(Math,Q),Se=P[re[Q.indexOf(he)]].getBoundingClientRect().width;A.left="".concat(Math.abs(fe-(he+Se))/2,"px"),A.transform="translate(-50%, 0)"}else A.visibility="hidden"}q(le),I(A)}},[i,s]),[z,x]};e.useThumbOverlap=_;function L(i,s,c,b){var R=i.getBoundingClientRect(),p=R.left,O=R.top,$=R.width,x=R.height;return F(b)?Math.abs(c-(O+x/2)):Math.abs(s-(p+$/2))}var H=function(){var i,s=((i=navigator.userAgentData)===null||i===void 0?void 0:i.platform)||navigator.platform;return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(s)||navigator.userAgent.includes("Mac")&&"ontouchend"in document};e.isIOS=H}(ue)),ue}var Ne;function Et(){if(Ne)return U;Ne=1;var e=U&&U.__extends||function(){var M=function(y,d){return M=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,a){t.__proto__=a}||function(t,a){for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&(t[l]=a[l])},M(y,d)};return function(y,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");M(y,d);function t(){this.constructor=y}y.prototype=d===null?Object.create(d):(t.prototype=d.prototype,new t)}}(),r=U&&U.__createBinding||(Object.create?function(M,y,d,t){t===void 0&&(t=d);var a=Object.getOwnPropertyDescriptor(y,d);(!a||("get"in a?!y.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return y[d]}}),Object.defineProperty(M,t,a)}:function(M,y,d,t){t===void 0&&(t=d),M[t]=y[d]}),n=U&&U.__setModuleDefault||(Object.create?function(M,y){Object.defineProperty(M,"default",{enumerable:!0,value:y})}:function(M,y){M.default=y}),o=U&&U.__importStar||function(M){if(M&&M.__esModule)return M;var y={};if(M!=null)for(var d in M)d!=="default"&&Object.prototype.hasOwnProperty.call(M,d)&&r(y,M,d);return n(y,M),y},g=U&&U.__spreadArray||function(M,y,d){if(d||arguments.length===2)for(var t=0,a=y.length,l;t<a;t++)(l||!(t in y))&&(l||(l=Array.prototype.slice.call(y,0,t)),l[t]=y[t]);return M.concat(l||Array.prototype.slice.call(y))};Object.defineProperty(U,"__esModule",{value:!0});var S=o(Ke()),u=Ye(),f=$e(),j=["ArrowRight","ArrowUp","k","PageUp"],F=["ArrowLeft","ArrowDown","j","PageDown"],B=function(M){e(y,M);function y(d){var t=M.call(this,d)||this;if(t.trackRef=S.createRef(),t.thumbRefs=[],t.state={draggedTrackPos:[-1,-1],draggedThumbIndex:-1,thumbZIndexes:new Array(t.props.values.length).fill(0).map(function(a,l){return l}),isChanged:!1,markOffsets:[]},t.getOffsets=function(){var a=t.props,l=a.direction,v=a.values,h=a.min,m=a.max,E=t.trackRef.current;if(!E)return console.warn("No track element found."),[];var k=E.getBoundingClientRect(),T=(0,u.getPaddingAndBorder)(E);return t.getThumbs().map(function(w,D){var _={x:0,y:0},L=w.getBoundingClientRect(),H=(0,u.getMargin)(w);switch(l){case f.Direction.Right:return _.x=(H.left+T.left)*-1,_.y=((L.height-k.height)/2+T.top)*-1,_.x+=k.width*(0,u.relativeValue)(v[D],h,m)-L.width/2,_;case f.Direction.Left:return _.x=(H.right+T.right)*-1,_.y=((L.height-k.height)/2+T.top)*-1,_.x+=k.width-k.width*(0,u.relativeValue)(v[D],h,m)-L.width/2,_;case f.Direction.Up:return _.x=((L.width-k.width)/2+H.left+T.left)*-1,_.y=-T.left,_.y+=k.height-k.height*(0,u.relativeValue)(v[D],h,m)-L.height/2,_;case f.Direction.Down:return _.x=((L.width-k.width)/2+H.left+T.left)*-1,_.y=-T.left,_.y+=k.height*(0,u.relativeValue)(v[D],h,m)-L.height/2,_;default:return(0,u.assertUnreachable)(l)}})},t.getThumbs=function(){return t.trackRef&&t.trackRef.current?Array.from(t.trackRef.current.children).filter(function(a){return a.hasAttribute("aria-valuenow")}):(console.warn("No thumbs found in the track container. Did you forget to pass & spread the `props` param in renderTrack?"),[])},t.getTargetIndex=function(a){return t.getThumbs().findIndex(function(l){return l===a.target||l.contains(a.target)})},t.addTouchEvents=function(a){document.addEventListener("touchmove",t.schdOnTouchMove,{passive:!1}),document.addEventListener("touchend",t.schdOnEnd,{passive:!1}),document.addEventListener("touchcancel",t.schdOnEnd,{passive:!1})},t.addMouseEvents=function(a){document.addEventListener("mousemove",t.schdOnMouseMove),document.addEventListener("mouseup",t.schdOnEnd)},t.onMouseDownTrack=function(a){var l;if(!(a.button!==0||(0,u.isIOS)()))if(a.persist(),a.preventDefault(),t.addMouseEvents(a.nativeEvent),t.props.values.length>1&&t.props.draggableTrack){if(t.thumbRefs.some(function(h){var m;return(m=h.current)===null||m===void 0?void 0:m.contains(a.target)}))return;t.setState({draggedTrackPos:[a.clientX,a.clientY]},function(){return t.onMove(a.clientX,a.clientY)})}else{var v=(0,u.getClosestThumbIndex)(t.thumbRefs.map(function(h){return h.current}),a.clientX,a.clientY,t.props.direction);(l=t.thumbRefs[v].current)===null||l===void 0||l.focus(),t.setState({draggedThumbIndex:v},function(){return t.onMove(a.clientX,a.clientY)})}},t.onResize=function(){(0,u.translateThumbs)(t.getThumbs(),t.getOffsets(),t.props.rtl),t.calculateMarkOffsets()},t.onTouchStartTrack=function(a){var l;if(a.persist(),t.addTouchEvents(a.nativeEvent),t.props.values.length>1&&t.props.draggableTrack){if(t.thumbRefs.some(function(h){var m;return(m=h.current)===null||m===void 0?void 0:m.contains(a.target)}))return;t.setState({draggedTrackPos:[a.touches[0].clientX,a.touches[0].clientY]},function(){return t.onMove(a.touches[0].clientX,a.touches[0].clientY)})}else{var v=(0,u.getClosestThumbIndex)(t.thumbRefs.map(function(h){return h.current}),a.touches[0].clientX,a.touches[0].clientY,t.props.direction);(l=t.thumbRefs[v].current)===null||l===void 0||l.focus(),t.setState({draggedThumbIndex:v},function(){return t.onMove(a.touches[0].clientX,a.touches[0].clientY)})}},t.onMouseOrTouchStart=function(a){if(!t.props.disabled){var l=(0,u.isTouchEvent)(a);if(!(!l&&a.button!==0)){var v=t.getTargetIndex(a);v!==-1&&(l?t.addTouchEvents(a):t.addMouseEvents(a),t.setState({draggedThumbIndex:v,thumbZIndexes:t.state.thumbZIndexes.map(function(h,m){return m===v?Math.max.apply(Math,t.state.thumbZIndexes):h<=t.state.thumbZIndexes[v]?h:h-1})}))}}},t.onMouseMove=function(a){a.preventDefault(),t.onMove(a.clientX,a.clientY)},t.onTouchMove=function(a){a.preventDefault(),t.onMove(a.touches[0].clientX,a.touches[0].clientY)},t.onKeyDown=function(a){var l=t.props,v=l.values,h=l.onChange,m=l.step,E=l.rtl,k=l.direction,T=t.state.isChanged,w=t.getTargetIndex(a.nativeEvent),D=E||k===f.Direction.Left||k===f.Direction.Down?-1:1;w!==-1&&(j.includes(a.key)?(a.preventDefault(),t.setState({draggedThumbIndex:w,isChanged:!0}),h((0,u.replaceAt)(v,w,t.normalizeValue(v[w]+D*(a.key==="PageUp"?m*10:m),w)))):F.includes(a.key)?(a.preventDefault(),t.setState({draggedThumbIndex:w,isChanged:!0}),h((0,u.replaceAt)(v,w,t.normalizeValue(v[w]-D*(a.key==="PageDown"?m*10:m),w)))):a.key==="Tab"?t.setState({draggedThumbIndex:-1},function(){T&&t.fireOnFinalChange()}):T&&t.fireOnFinalChange())},t.onKeyUp=function(a){var l=t.state.isChanged;t.setState({draggedThumbIndex:-1},function(){l&&t.fireOnFinalChange()})},t.onMove=function(a,l){var v=t.state,h=v.draggedThumbIndex,m=v.draggedTrackPos,E=t.props,k=E.direction,T=E.min,w=E.max,D=E.onChange,_=E.values,L=E.step,H=E.rtl;if(h===-1&&m[0]===-1&&m[1]===-1)return null;var i=t.trackRef.current;if(!i)return null;var s=i.getBoundingClientRect(),c=(0,u.isVertical)(k)?s.height:s.width;if(m[0]!==-1&&m[1]!==-1){var b=a-m[0],R=l-m[1],p=0;switch(k){case f.Direction.Right:case f.Direction.Left:p=b/c*(w-T);break;case f.Direction.Down:case f.Direction.Up:p=R/c*(w-T);break;default:(0,u.assertUnreachable)(k)}if(H&&(p*=-1),Math.abs(p)>=L/2){for(var O=0;O<t.thumbRefs.length;O++){if(_[O]===w&&Math.sign(p)===1||_[O]===T&&Math.sign(p)===-1)return;var $=_[O]+p;$>w?p=w-_[O]:$<T&&(p=T-_[O])}for(var x=_.slice(0),O=0;O<t.thumbRefs.length;O++)x=(0,u.replaceAt)(x,O,t.normalizeValue(_[O]+p,O));t.setState({draggedTrackPos:[a,l]}),D(x)}}else{var I=0;switch(k){case f.Direction.Right:I=(a-s.left)/c*(w-T)+T;break;case f.Direction.Left:I=(c-(a-s.left))/c*(w-T)+T;break;case f.Direction.Down:I=(l-s.top)/c*(w-T)+T;break;case f.Direction.Up:I=(c-(l-s.top))/c*(w-T)+T;break;default:(0,u.assertUnreachable)(k)}H&&(I=w+T-I),Math.abs(_[h]-I)>=L/2&&D((0,u.replaceAt)(_,h,t.normalizeValue(I,h)))}},t.normalizeValue=function(a,l){var v=t.props,h=v.min,m=v.max,E=v.step,k=v.allowOverlap,T=v.values;return(0,u.normalizeValue)(a,l,h,m,E,k,T)},t.onEnd=function(a){if(a.preventDefault(),document.removeEventListener("mousemove",t.schdOnMouseMove),document.removeEventListener("touchmove",t.schdOnTouchMove),document.removeEventListener("mouseup",t.schdOnEnd),document.removeEventListener("touchend",t.schdOnEnd),document.removeEventListener("touchcancel",t.schdOnEnd),t.state.draggedThumbIndex===-1&&t.state.draggedTrackPos[0]===-1&&t.state.draggedTrackPos[1]===-1)return null;t.setState({draggedThumbIndex:-1,draggedTrackPos:[-1,-1]},function(){t.fireOnFinalChange()})},t.fireOnFinalChange=function(){t.setState({isChanged:!1});var a=t.props,l=a.onFinalChange,v=a.values;l&&l(v)},t.updateMarkRefs=function(a){if(!a.renderMark){t.numOfMarks=void 0,t.markRefs=void 0;return}t.numOfMarks=(a.max-a.min)/t.props.step,t.markRefs=[];for(var l=0;l<t.numOfMarks+1;l++)t.markRefs[l]=S.createRef()},t.calculateMarkOffsets=function(){if(!(!t.props.renderMark||!t.trackRef||!t.numOfMarks||!t.markRefs||t.trackRef.current===null)){for(var a=window.getComputedStyle(t.trackRef.current),l=parseInt(a.width,10),v=parseInt(a.height,10),h=parseInt(a.paddingLeft,10),m=parseInt(a.paddingTop,10),E=[],k=0;k<t.numOfMarks+1;k++){var T=9999,w=9999;if(t.markRefs[k].current){var D=t.markRefs[k].current.getBoundingClientRect();T=D.height,w=D.width}t.props.direction===f.Direction.Left||t.props.direction===f.Direction.Right?E.push([Math.round(l/t.numOfMarks*k+h-w/2),-Math.round((T-v)/2)]):E.push([Math.round(v/t.numOfMarks*k+m-T/2),-Math.round((w-l)/2)])}t.setState({markOffsets:E})}},d.step===0)throw new Error('"step" property should be a positive number');return t.schdOnMouseMove=(0,u.schd)(t.onMouseMove),t.schdOnTouchMove=(0,u.schd)(t.onTouchMove),t.schdOnEnd=(0,u.schd)(t.onEnd),t.thumbRefs=d.values.map(function(){return S.createRef()}),t.updateMarkRefs(d),t}return y.prototype.componentDidMount=function(){var d=this,t=this.props,a=t.values,l=t.min,v=t.step;this.resizeObserver=window.ResizeObserver?new window.ResizeObserver(this.onResize):{observe:function(){return window.addEventListener("resize",d.onResize)},unobserve:function(){return window.removeEventListener("resize",d.onResize)}},document.addEventListener("touchstart",this.onMouseOrTouchStart,{passive:!1}),document.addEventListener("mousedown",this.onMouseOrTouchStart,{passive:!1}),!this.props.allowOverlap&&(0,u.checkInitialOverlap)(this.props.values),this.props.values.forEach(function(h){return(0,u.checkBoundaries)(h,d.props.min,d.props.max)}),this.resizeObserver.observe(this.trackRef.current),(0,u.translateThumbs)(this.getThumbs(),this.getOffsets(),this.props.rtl),this.calculateMarkOffsets(),a.forEach(function(h){(0,u.isStepDivisible)(l,h,v)||console.warn("The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.")})},y.prototype.componentDidUpdate=function(d,t){var a=this.props,l=a.max,v=a.min,h=a.step,m=a.values,E=a.rtl;(d.max!==l||d.min!==v||d.step!==h)&&this.updateMarkRefs(this.props),(0,u.translateThumbs)(this.getThumbs(),this.getOffsets(),E),(d.max!==l||d.min!==v||d.step!==h||t.markOffsets.length!==this.state.markOffsets.length)&&(this.calculateMarkOffsets(),m.forEach(function(k){(0,u.isStepDivisible)(v,k,h)||console.warn("The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.")}))},y.prototype.componentWillUnmount=function(){var d={passive:!1};document.removeEventListener("mousedown",this.onMouseOrTouchStart,d),document.removeEventListener("mousemove",this.schdOnMouseMove),document.removeEventListener("touchmove",this.schdOnTouchMove),document.removeEventListener("touchstart",this.onMouseOrTouchStart),document.removeEventListener("mouseup",this.schdOnEnd),document.removeEventListener("touchend",this.schdOnEnd),this.resizeObserver.unobserve(this.trackRef.current)},y.prototype.render=function(){var d=this,t=this.props,a=t.label,l=t.labelledBy,v=t.renderTrack,h=t.renderThumb,m=t.renderMark,E=m===void 0?function(){return null}:m,k=t.values,T=t.min,w=t.max,D=t.allowOverlap,_=t.disabled,L=this.state,H=L.draggedThumbIndex,i=L.thumbZIndexes,s=L.markOffsets;return v({props:{style:{transform:"scale(1)",cursor:H>-1?"grabbing":this.props.draggableTrack?(0,u.isVertical)(this.props.direction)?"ns-resize":"ew-resize":k.length===1&&!_?"pointer":"inherit"},onMouseDown:_?u.voidFn:this.onMouseDownTrack,onTouchStart:_?u.voidFn:this.onTouchStartTrack,ref:this.trackRef},isDragged:this.state.draggedThumbIndex>-1,disabled:_,children:g(g([],s.map(function(c,b,R){return E({props:{style:d.props.direction===f.Direction.Left||d.props.direction===f.Direction.Right?{position:"absolute",left:"".concat(c[0],"px"),marginTop:"".concat(c[1],"px")}:{position:"absolute",top:"".concat(c[0],"px"),marginLeft:"".concat(c[1],"px")},key:"mark".concat(b),ref:d.markRefs[b]},index:b})}),!0),k.map(function(c,b){var R=d.state.draggedThumbIndex===b;return h({index:b,value:c,isDragged:R,props:{style:{position:"absolute",zIndex:i[b],cursor:_?"inherit":R?"grabbing":"grab",userSelect:"none",touchAction:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},key:b,tabIndex:_?void 0:0,"aria-valuemax":D?w:k[b+1]||w,"aria-valuemin":D?T:k[b-1]||T,"aria-valuenow":c,draggable:!1,ref:d.thumbRefs[b],"aria-label":a,"aria-labelledby":l,role:"slider",onKeyDown:_?u.voidFn:d.onKeyDown,onKeyUp:_?u.voidFn:d.onKeyUp}})}),!0)})},y.defaultProps={label:"Accessibility label",labelledBy:null,step:1,direction:f.Direction.Right,rtl:!1,disabled:!1,allowOverlap:!1,draggableTrack:!1,min:0,max:100},y}(S.Component);return U.default=B,U}var Ue;function It(){return Ue||(Ue=1,function(e){var r=se&&se.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(e,"__esModule",{value:!0}),e.checkValuesAgainstBoundaries=e.relativeValue=e.useThumbOverlap=e.Direction=e.getTrackBackground=e.Range=void 0;var n=r(Et());e.Range=n.default;var o=Ye();Object.defineProperty(e,"getTrackBackground",{enumerable:!0,get:function(){return o.getTrackBackground}}),Object.defineProperty(e,"useThumbOverlap",{enumerable:!0,get:function(){return o.useThumbOverlap}}),Object.defineProperty(e,"relativeValue",{enumerable:!0,get:function(){return o.relativeValue}}),Object.defineProperty(e,"checkValuesAgainstBoundaries",{enumerable:!0,get:function(){return o.checkValuesAgainstBoundaries}});var g=$e();Object.defineProperty(e,"Direction",{enumerable:!0,get:function(){return g.Direction}})}(se)),se}var Ze=It();function He(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(g){return Object.getOwnPropertyDescriptor(e,g).enumerable})),n.push.apply(n,o)}return n}function ve(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?He(Object(n),!0).forEach(function(o){Ct(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):He(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Ct(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var me=J("div",{position:"relative",width:"100%"});me.displayName="Root";me.displayName="Root";me.displayName="StyledRoot";var be=J("div",function(e){var r=e.$theme,n=e.$value,o=n===void 0?[]:n,g=e.$disabled,S=e.$isDragged,u=r.sizing,f="inherit";return g?f="not-allowed":S?f="grabbing":o.length===1&&(f="pointer"),{paddingTop:u.scale600,paddingBottom:u.scale600,paddingRight:u.scale600,paddingLeft:u.scale600,display:"flex",cursor:f,backgroundColor:r.colors.sliderTrackFill}});be.displayName="Track";be.displayName="Track";be.displayName="StyledTrack";var ye=J("div",function(e){var r=e.$theme,n=e.$value,o=n===void 0?[]:n,g=e.$min,S=e.$max,u=e.$disabled,f=r.colors,j=r.borders,F=r.direction,B=r.borders.useRoundedCorners?j.radius100:0;return{borderTopLeftRadius:B,borderTopRightRadius:B,borderBottomRightRadius:B,borderBottomLeftRadius:B,background:Ze.getTrackBackground({values:o,colors:o.length===1?[u?f.borderOpaque:f.primary,u?f.backgroundSecondary:f.borderOpaque]:[u?f.backgroundSecondary:f.borderOpaque,u?f.borderOpaque:f.primary,u?f.backgroundSecondary:f.borderOpaque],min:g||0,max:S||0,rtl:F==="rtl"}),height:"2px",width:"100%",alignSelf:"center",cursor:u?"not-allowed":"inherit"}});ye.displayName="InnerTrack";ye.displayName="InnerTrack";ye.displayName="StyledInnerTrack";var Te=J("div",function(e){return{width:"4px",height:"2px",backgroundColor:e.$theme.colors.backgroundPrimary,marginLeft:"16px"}});Te.displayName="Mark";Te.displayName="Mark";Te.displayName="StyledMark";var Oe=J("div",function(e){return ve(ve({},e.$theme.typography.font200),{},{color:e.$theme.colors.contentPrimary})});Oe.displayName="Tick";Oe.displayName="Tick";Oe.displayName="StyledTick";var ke=J("div",function(e){var r=e.$theme,n=r.sizing;return{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:n.scale600,paddingLeft:n.scale600,paddingBottom:n.scale400}});ke.displayName="TickBar";ke.displayName="TickBar";ke.displayName="StyledTickBar";var we=J("div",function(e){var r=e.$theme,n=e.$value,o=n===void 0?[]:n,g=e.$thumbIndex,S=e.$disabled,u=o.length===2&&g===0,f=o.length===2&&g===1;return r.direction==="rtl"&&(f||u)&&(u=!u,f=!f),{height:"24px",width:"24px",borderTopLeftRadius:"24px",borderTopRightRadius:"24px",borderBottomLeftRadius:"24px",borderBottomRightRadius:"24px",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:S?r.colors.sliderHandleFillDisabled:r.colors.sliderHandleFill,outline:"none",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(r.colors.accent):"0 1px 4px rgba(0, 0, 0, 0.12)",cursor:S?"not-allowed":"inherit"}});we.displayName="Thumb";we.displayName="Thumb";we.displayName="StyledThumb";var Re=J("div",function(e){var r=e.$disabled,n=e.$theme;return{position:"absolute",top:"-16px",width:"4px",height:"20px",backgroundColor:r?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleInnerFill}});Re.displayName="InnerThumb";Re.displayName="InnerThumb";Re.displayName="StyledInnerThumb";var Me=J("div",function(e){var r=e.$disabled,n=e.$theme;return ve(ve({position:"absolute",top:"-".concat(n.sizing.scale1400)},n.typography.font200),{},{backgroundColor:r?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleInnerFill,color:n.colors.contentInversePrimary,paddingLeft:n.sizing.scale600,paddingRight:n.sizing.scale600,paddingTop:n.sizing.scale500,paddingBottom:n.sizing.scale500,borderBottomLeftRadius:"48px",borderBottomRightRadius:"48px",borderTopLeftRadius:"48px",borderTopRightRadius:"48px",whiteSpace:"nowrap"})});Me.displayName="ThumbValue";Me.displayName="ThumbValue";Me.displayName="StyledThumbValue";function qe(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(g){return Object.getOwnPropertyDescriptor(e,g).enumerable})),n.push.apply(n,o)}return n}function Dt(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?qe(Object(n),!0).forEach(function(o){xt(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qe(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function xt(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function X(){return X=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},X.apply(this,arguments)}function K(e,r){return Lt(e)||Bt(e,r)||At(e,r)||Pt()}function Pt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function At(e,r){if(e){if(typeof e=="string")return We(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return We(e,r)}}function We(e,r){(r==null||r>e.length)&&(r=e.length);for(var n=0,o=new Array(r);n<r;n++)o[n]=e[n];return o}function Bt(e,r){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var o=[],g=!0,S=!1,u,f;try{for(n=n.call(e);!(g=(u=n.next()).done)&&(o.push(u.value),!(r&&o.length===r));g=!0);}catch(j){S=!0,f=j}finally{try{!g&&n.return!=null&&n.return()}finally{if(S)throw f}}return o}}function Lt(e){if(Array.isArray(e))return e}var Ft=function(r){if(r.length>2||r.length===0)throw new Error("the value prop represents positions of thumbs, so its length can be only one or two");return r};function jt(e){var r=e.overrides,n=r===void 0?{}:r,o=e.disabled,g=o===void 0?!1:o,S=e.marks,u=S===void 0?!1:S,f=e.onChange,j=f===void 0?function(){}:f,F=e.onFinalChange,B=F===void 0?function(){}:F,M=e.min,y=M===void 0?0:M,d=e.max,t=d===void 0?100:d,a=e.step,l=a===void 0?1:a,v=e.persistentThumb,h=v===void 0?!1:v,m=e.valueToLabel,E=m===void 0?function(Y){return Y}:m,k=e.value,T=C.useContext(gt),w=C.useState(!1),D=K(w,2),_=D[0],L=D[1],H=C.useState(!1),i=K(H,2),s=i[0],c=i[1],b=C.useState(!1),R=K(b,2),p=R[0],O=R[1],$=C.useState(-1),x=K($,2),I=x[0],N=x[1],z=C.useCallback(function(Y){pt(Y)&&O(!0);var V=Y.target.parentNode.firstChild===Y.target?0:1;N(V)},[]),q=C.useCallback(function(Y){p!==!1&&O(!1),N(-1)},[]),P=Ft(k),A={$disabled:g,$step:l,$min:y,$max:t,$marks:u,$value:P,$isFocusVisible:p},Z=G(n.Root,me),re=K(Z,2),le=re[0],Q=re[1],de=G(n.Track,be),fe=K(de,2),he=fe[0],Se=fe[1],ee=G(n.InnerTrack,ye),oe=K(ee,2),ge=oe[0],pe=oe[1],Ge=G(n.Thumb,we),Ee=K(Ge,2),Je=Ee[0],Qe=Ee[1],et=G(n.InnerThumb,Re),Ie=K(et,2),tt=Ie[0],rt=Ie[1],nt=G(n.ThumbValue,Me),Ce=K(nt,2),at=Ce[0],it=Ce[1],ot=G(n.Tick,Oe),De=K(ot,2),xe=De[0],Pe=De[1],st=G(n.TickBar,ke),Ae=K(st,2),ut=Ae[0],ct=Ae[1],lt=G(n.Mark,Te),Be=K(lt,2),dt=Be[0],ft=Be[1];return C.createElement(le,X({"data-baseweb":"slider"},A,Q,{onFocus:mt(Q,z),onBlur:vt(Q,q)}),C.createElement(Ze.Range,X({step:l,min:y,max:t,values:P,disabled:g,onChange:function(V){return j({value:V})},onFinalChange:function(V){return B({value:V})},rtl:T.direction==="rtl",renderTrack:function(V){var te=V.props,W=V.children,ne=V.isDragged;return C.createElement(he,X({onMouseDown:te.onMouseDown,onTouchStart:te.onTouchStart,$isDragged:ne},A,Se),C.createElement(ge,X({$isDragged:ne,ref:te.ref},A,pe),W))},renderThumb:function(V){var te=V.props,W=V.index,ne=V.isDragged,Le=h||(!!W&&s||!W&&_||ne)&&!g;return C.createElement(Je,X({},te,{onMouseEnter:function(){W===0?L(!0):c(!0)},onMouseLeave:function(){W===0?L(!1):c(!1)},$thumbIndex:W,$isDragged:ne,style:Dt({},te.style)},A,Qe,{$isFocusVisible:p&&I===W}),Le&&C.createElement(at,X({$thumbIndex:W,$isDragged:ne},A,it),E(P[W])),Le&&C.createElement(tt,X({$thumbIndex:W,$isDragged:ne},A,rt)))}},u?{renderMark:function(V){var te=V.props,W=V.index;return C.createElement(dt,X({$markIndex:W},te,A,ft))}}:{})),C.createElement(ut,X({},A,ct),C.createElement(xe,X({},A,Pe),E(y)),C.createElement(xe,X({},A,Pe),E(t))))}const zt=Xe("div",{target:"erqzm8u0"})(({disabled:e,theme:r,isDragged:n})=>({alignItems:"center",backgroundColor:e?r.colors.gray:r.colors.primary,borderTopLeftRadius:"100%",borderTopRightRadius:"100%",borderBottomLeftRadius:"100%",borderBottomRightRadius:"100%",borderTopStyle:"none",borderBottomStyle:"none",borderRightStyle:"none",borderLeftStyle:"none",display:"flex",justifyContent:"center",height:r.sizes.sliderThumb,width:r.sizes.sliderThumb,boxShadow:n?`0 0 0 0.2rem ${Fe(r.colors.primary,.5)}`:"none",":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 0.2rem ${Fe(r.colors.primary,.5)}`}})),Vt=Xe("div",{target:"erqzm8u1"})(({disabled:e,theme:r})=>({fontFamily:r.genericFonts.bodyFont,fontSize:r.fontSizes.sm,color:e?r.colors.gray:r.colors.primary,top:"-1.6em",position:"absolute",whiteSpace:"nowrap",backgroundColor:r.colors.transparent,lineHeight:r.lineHeights.base,fontWeight:r.fontWeights.normal,pointerEvents:"none"}));function Nt({disabled:e,element:r,widgetMgr:n,fragmentId:o}){const[g,S]=$t({getStateFromWidgetMgr:Ut,getDefaultStateFromProto:Ht,getCurrStateFromProto:qt,updateWidgetMgrState:Wt,element:r,widgetMgr:n,fragmentId:o}),[u,f]=C.useState(g),j=C.useRef(null),[F]=C.useState([]),[B]=C.useState([]),M=yt(),y=u.map(h=>Xt(h,r)),d=r.label;C.useEffect(()=>{f(g)},[g]);const t=C.useCallback(({value:h})=>{S({value:h,fromUi:!0})},[S]),a=C.useCallback(({value:h})=>{f(h)},[]),l=C.useCallback(C.forwardRef(function(m,E){const{$thumbIndex:k}=m,T=k||0;F[T]=E,B[T]||=C.createRef();const w=Tt(m,["role","style","aria-valuemax","aria-valuemin","aria-valuenow","tabIndex","onKeyUp","onKeyDown","onMouseEnter","onMouseLeave","draggable"]),D=y[T];return ae(zt,{...w,disabled:m.$disabled===!0,isDragged:m.$isDragged===!0,ref:F[T],"aria-valuetext":D,"aria-label":d,children:ae(Vt,{"data-testid":"stSliderThumbValue",disabled:m.$disabled===!0,ref:B[T],children:D})})}),[]);C.useEffect(()=>{B.map((w,D)=>{w.current&&(w.current.innerText=y[D])}),F.map((w,D)=>{w.current&&w.current.setAttribute("aria-valuetext",y[D])});const h=j.current??null,m=F[0].current,E=F[1]?.current,k=B[0].current,T=B[1]?.current;Zt(h,m,E,k,T)});const v=C.useCallback(({$disabled:h})=>({height:M.spacing.twoXS,...h?{background:M.colors.darkenedBgMix25}:{}}),[M.colors.darkenedBgMix25,M.spacing.twoXS]);return Ot("div",{ref:j,className:"stSlider","data-testid":"stSlider",children:[ae(St,{label:r.label,disabled:e,labelVisibility:kt(r.labelVisibility?.value),children:r.help&&ae(wt,{children:ae(Rt,{content:r.help,placement:Mt.TOP_RIGHT})})}),ae(jt,{min:r.min,max:r.max,step:r.step,value:Yt(u,r),onChange:a,onFinalChange:t,disabled:e,overrides:{Thumb:l,Track:{style:{backgroundColor:"none !important",paddingLeft:M.spacing.none,paddingRight:M.spacing.none,paddingTop:`calc((${M.sizes.minElementHeight} - ${M.spacing.twoXS}) / 2)`,paddingBottom:`calc((${M.sizes.minElementHeight} - ${M.spacing.twoXS}) / 2)`}},InnerTrack:{style:v},TickBar:()=>null}})]})}function Ut(e,r){return e.getDoubleArrayValue(r)}function Ht(e){return e.default}function qt(e){return e.value}function Wt(e,r,n,o){r.setDoubleArrayValue(e,n.value,{fromUi:n.fromUi},o)}function Kt(e){const{dataType:r}=e;return r===_e.DataType.DATETIME||r===_e.DataType.DATE||r===_e.DataType.TIME}function Xt(e,r){const{format:n,options:o}=r;return Kt(r)?_t.utc(e/1e3).format(n):o.length>0?je.sprintf(n,o[e]):je.sprintf(n,e)}function Yt(e,r){const{min:n,max:o}=r;let g=e[0],S=e.length>1?e[1]:e[0];return g>S&&(g=S),g<n&&(g=n),g>o&&(g=o),S<n&&(S=n),S>o&&(S=o),e.length>1?[g,S]:[g]}function Zt(e,r,n,o,g){!e||!r||!o||(ie(e,r,o),n&&g&&(ie(e,n,g),Gt(e,r,n,o,g)))}function ie(e,r,n){const o=e.getBoundingClientRect(),g=r.getBoundingClientRect(),S=n.getBoundingClientRect(),u=g.left+g.width/2,f=u-S.width/2<o.left,j=u+S.width/2>o.right;n.style.left=f?"0":"",n.style.right=j?"0":""}function Gt(e,r,n,o,g){const u=e.getBoundingClientRect(),f=r.getBoundingClientRect(),j=n.getBoundingClientRect(),F=o.getBoundingClientRect(),B=g.getBoundingClientRect(),M=u.left+u.width/2,y=f.left+f.width/2,d=j.left+j.width/2,t=y-F.width/2>=u.left,a=d+B.width/2<=u.right,l=f.left-F.width>=u.left,v=j.right+B.width<=u.right,h=t?F.width/2:F.width,m=a?B.width/2:B.width,E=y+h;if(d-m-E>24){ie(e,r,o),ie(e,n,g);return}if(l&&v){o.style.left="",o.style.right=`${Math.round(f.width)}px`,g.style.left=`${Math.round(j.width)}px`,g.style.right="";return}y<M?(ie(e,r,o),g.style.left=`${Math.round(y+h+24-d)}px`,g.style.right=""):(ie(e,n,g),o.style.left="",o.style.right=`${-Math.round(d-m-24-y)}px`)}const rr=bt(C.memo(Nt));export{rr as default};
@@ -1,4 +1,4 @@
1
- import{r as reactExports,j as jsx}from"./index.DKN5MVff.js";/*!
1
+ import{r as reactExports,j as jsx}from"./index.CD8HuT3N.js";/*!
2
2
  * Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors
3
3
  * All rights reserved.
4
4
  *
@@ -1,2 +1,2 @@
1
- import{by as q,bz as J,r as c,bA as Q,ap as Y,bB as ee,bC as l,j as E,aE as te,bu as re,bD as ne,bv as oe,bc as ie,bE as ae,bw as ue,bF as le,br as ce,b8 as P,b7 as x,ba as se}from"./index.DKN5MVff.js";import{a as fe}from"./useBasicWidgetState.DB3vMS9V.js";import"./FormClearHelper.DF4gFAOO.js";var pe={secondary:"secondary"},N={default:"default"},de={default:"default"},k=Object.freeze({radio:"radio",checkbox:"checkbox"}),z=q("div",function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=r===1?void 0:t!==N.default?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}});z.displayName="StyledRoot";z.displayName="StyledRoot";function M(e){"@babel/helpers - typeof";return M=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(e)}function $(){return $=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$.apply(this,arguments)}function X(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function ye(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?X(Object(r),!0).forEach(function(n){V(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function be(e,t){return ge(e)||Se(e,t)||me(e,t)||he()}function he(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function me(e,t){if(e){if(typeof e=="string")return F(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return F(e,t)}}function F(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Se(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,d;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(s){i=!0,d=s}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw d}}return n}}function ge(e){if(Array.isArray(e))return e}function ve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Oe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ee(e,t,r){return t&&Oe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&G(e,t)}function G(e,t){return G=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},G(e,t)}function we(e){var t=Re();return function(){var n=B(e),o;if(t){var i=B(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Le(this,o)}}function Le(e,t){if(t&&(M(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return K(e)}function K(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Re(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function B(e){return B=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},B(e)}function V(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ce(e,t){return!Array.isArray(e)&&typeof e!="number"?!1:Array.isArray(e)?e.includes(t):e===t}var H=function(e){_e(r,e);var t=we(r);function r(){var n;ve(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=t.call.apply(t,[this].concat(i)),V(K(n),"childRefs",{}),n}return Ee(r,[{key:"render",value:function(){var o=this,i=this.props,a=i.overrides,d=a===void 0?{}:a,s=i.mode,y=s===void 0?k.checkbox:s,g=i.children,b=i.selected,_=i.disabled,f=i.onClick,h=i.kind,v=i.shape,m=i.size,A=J(d.Root,z),w=be(A,2),I=w[0],R=w[1],L=this.props["aria-label"]||this.props.ariaLabel,p=y===k.radio,U=c.Children.count(g);return c.createElement(Q.Consumer,null,function(Z){return c.createElement(I,$({"aria-label":L||Z.buttongroup.ariaLabel,"data-baseweb":"button-group",role:p?"radiogroup":"group",$shape:v,$length:g.length},R),c.Children.map(g,function(S,C){if(!c.isValidElement(S))return null;var T=S.props.isSelected?S.props.isSelected:Ce(b,C);return p&&(o.childRefs[C]=c.createRef()),c.cloneElement(S,{disabled:_||S.props.disabled,isSelected:T,ref:p?o.childRefs[C]:void 0,tabIndex:!p||T||p&&(!b||b===-1)&&C===0?0:-1,onKeyDown:function(u){if(p){var O=Number(b)?Number(b):0;if(u.key==="ArrowUp"||u.key==="ArrowLeft"){u.preventDefault&&u.preventDefault();var D=O-1<0?U-1:O-1;f&&f(u,D),o.childRefs[D].current&&o.childRefs[D].current.focus()}if(u.key==="ArrowDown"||u.key==="ArrowRight"){u.preventDefault&&u.preventDefault();var j=O+1>U-1?0:O+1;f&&f(u,j),o.childRefs[j].current&&o.childRefs[j].current.focus()}}},kind:h,onClick:function(u){_||(S.props.onClick&&S.props.onClick(u),f&&f(u,C))},shape:v,size:m,overrides:ye({BaseButton:{style:function(u){var O=u.$theme;return g.length===1?{}:v!==N.default?{marginLeft:O.sizing.scale100,marginRight:O.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":T,role:p?"radio":"checkbox"}}},S.props.overrides)})}))})}}]),r}(c.Component);V(H,"defaultProps",{disabled:!1,onClick:function(){},shape:N.default,size:de.default,kind:pe.secondary});function Pe(e,t){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}function ke(e,t,r){return e==l.ClickMode.MULTI_SELECT?Pe(t,r??[]):r?.includes(t)?[]:[t]}function Be(e){return e.length===0?-1:e[0]}function Ae(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function Ie(e,t,r){const n=r===l.Style.PILLS?P.PILLS:r===l.Style.BORDERLESS?P.BORDERLESS_ICON:P.SEGMENTED_CONTROL,o=r===l.Style.BORDERLESS?x.XSMALL:x.MEDIUM,i=n===P.PILLS||n===P.SEGMENTED_CONTROL,a=r===l.Style.BORDERLESS?"lg":"base";return{element:E(se,{icon:t,label:e,iconSize:a,useSmallerFont:i}),kind:n,size:o}}function Te(e,t,r,n){return r.indexOf(n)>-1?!0:t!==l.ClickMode.SINGLE_SELECT||e!==l.SelectionVisualization.ALL_UP_TO_SELECTED?!1:r.length>0&&n<r[0]}function De(e,t){return e&&(t=`${t}Active`),t}function je(e,t,r){const n={flexWrap:"wrap",maxWidth:"100%",margin:"0 0"},o=r?"100%":"auto",i=r?{}:{content:"''",flex:1e4};switch(e){case l.Style.BORDERLESS:return{...n,columnGap:t.threeXS,rowGap:t.threeXS};case l.Style.PILLS:return{...n,columnGap:t.twoXS,rowGap:t.twoXS,width:o};case l.Style.SEGMENTED_CONTROL:return{...n,columnGap:t.none,rowGap:t.twoXS,"::after":i,width:o};default:return n}}function Me(e,t,r,n,o,i,a){const d=Te(r,n,o,t);let s=e.content,y=e.contentIcon;return d&&(s=e.selectedContent?e.selectedContent:s,y=e.selectedContentIcon?e.selectedContentIcon:y),c.forwardRef(function(b,_){const{element:f,kind:h,size:v}=Ie(s??"",y??void 0,i),m=De(!!(d&&!e.selectedContent&&!e.selectedContentIcon),h);return E(ce,{...b,size:v,kind:m,containerWidth:a,children:f})})}function $e(e,t){return e.getIntArrayValue(t)}function Ge(e){return e.default??null}function Ne(e){return e.value??null}function ze(e){const{disabled:t,element:r,fragmentId:n,widgetMgr:o,widthConfig:i}=e,{clickMode:a,options:d,selectionVisualization:s,style:y,label:g,labelVisibility:b,help:_}=r,f=Y(),[h,v]=fe({getStateFromWidgetMgr:$e,getDefaultStateFromProto:Ge,getCurrStateFromProto:Ne,updateWidgetMgrState:Ae,element:r,widgetMgr:o,fragmentId:n}),m=ee(i),A=(R,L)=>{const p=ke(a,L,h);v({value:p,fromUi:!0})};let w;a===l.ClickMode.SINGLE_SELECT?w=k.radio:a===l.ClickMode.MULTI_SELECT&&(w=k.checkbox);const I=c.useMemo(()=>d.map((R,L)=>{const p=Me(R,L,s,a,h,y,m);return E(p,{},`${R.content}-${L}`)}),[a,d,s,y,h,m]);return te(le,{className:"stButtonGroup","data-testid":"stButtonGroup",containerWidth:m,children:[E(ue,{label:g,disabled:t,labelVisibility:re(b?.value??ae.LabelVisibilityOptions.COLLAPSED),children:_&&E(ne,{children:E(oe,{content:_,placement:ie.TOP})})}),E(H,{disabled:t,mode:w,onClick:A,selected:a===l.ClickMode.MULTI_SELECT?h:Be(h),overrides:{Root:{style:c.useCallback(()=>je(y,f.spacing,m),[y,f.spacing,m])}},children:I})]})}const xe=c.memo(ze);export{xe as default};
1
+ import{ad as q,p as J,r as c,au as Q,u as Y,av as ee,aw as l,j as E,e as te,l as re,f as ne,T as oe,P as ie,ax as ae,W as ue,ay as le,b as ce,B as P,c as x,D as se}from"./index.CD8HuT3N.js";import{u as fe}from"./useBasicWidgetState.DeK-QJpD.js";import"./FormClearHelper.DHh1GFzm.js";var pe={secondary:"secondary"},N={default:"default"},de={default:"default"},k=Object.freeze({radio:"radio",checkbox:"checkbox"}),z=q("div",function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=r===1?void 0:t!==N.default?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}});z.displayName="StyledRoot";z.displayName="StyledRoot";function M(e){"@babel/helpers - typeof";return M=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(e)}function $(){return $=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$.apply(this,arguments)}function X(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function ye(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?X(Object(r),!0).forEach(function(n){V(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function he(e,t){return ge(e)||Se(e,t)||me(e,t)||be()}function be(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function me(e,t){if(e){if(typeof e=="string")return K(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return K(e,t)}}function K(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Se(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,d;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(s){i=!0,d=s}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw d}}return n}}function ge(e){if(Array.isArray(e))return e}function ve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Oe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ee(e,t,r){return t&&Oe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&G(e,t)}function G(e,t){return G=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},G(e,t)}function we(e){var t=Re();return function(){var n=B(e),o;if(t){var i=B(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Le(this,o)}}function Le(e,t){if(t&&(M(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return F(e)}function F(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Re(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function B(e){return B=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},B(e)}function V(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ce(e,t){return!Array.isArray(e)&&typeof e!="number"?!1:Array.isArray(e)?e.includes(t):e===t}var H=function(e){_e(r,e);var t=we(r);function r(){var n;ve(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=t.call.apply(t,[this].concat(i)),V(F(n),"childRefs",{}),n}return Ee(r,[{key:"render",value:function(){var o=this,i=this.props,a=i.overrides,d=a===void 0?{}:a,s=i.mode,y=s===void 0?k.checkbox:s,g=i.children,h=i.selected,_=i.disabled,f=i.onClick,b=i.kind,v=i.shape,m=i.size,T=J(d.Root,z),w=he(T,2),I=w[0],R=w[1],L=this.props["aria-label"]||this.props.ariaLabel,p=y===k.radio,W=c.Children.count(g);return c.createElement(Q.Consumer,null,function(Z){return c.createElement(I,$({"aria-label":L||Z.buttongroup.ariaLabel,"data-baseweb":"button-group",role:p?"radiogroup":"group",$shape:v,$length:g.length},R),c.Children.map(g,function(S,C){if(!c.isValidElement(S))return null;var A=S.props.isSelected?S.props.isSelected:Ce(h,C);return p&&(o.childRefs[C]=c.createRef()),c.cloneElement(S,{disabled:_||S.props.disabled,isSelected:A,ref:p?o.childRefs[C]:void 0,tabIndex:!p||A||p&&(!h||h===-1)&&C===0?0:-1,onKeyDown:function(u){if(p){var O=Number(h)?Number(h):0;if(u.key==="ArrowUp"||u.key==="ArrowLeft"){u.preventDefault&&u.preventDefault();var D=O-1<0?W-1:O-1;f&&f(u,D),o.childRefs[D].current&&o.childRefs[D].current.focus()}if(u.key==="ArrowDown"||u.key==="ArrowRight"){u.preventDefault&&u.preventDefault();var j=O+1>W-1?0:O+1;f&&f(u,j),o.childRefs[j].current&&o.childRefs[j].current.focus()}}},kind:b,onClick:function(u){_||(S.props.onClick&&S.props.onClick(u),f&&f(u,C))},shape:v,size:m,overrides:ye({BaseButton:{style:function(u){var O=u.$theme;return g.length===1?{}:v!==N.default?{marginLeft:O.sizing.scale100,marginRight:O.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":A,role:p?"radio":"checkbox"}}},S.props.overrides)})}))})}}]),r}(c.Component);V(H,"defaultProps",{disabled:!1,onClick:function(){},shape:N.default,size:de.default,kind:pe.secondary});function Pe(e,t){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}function ke(e,t,r){return e==l.ClickMode.MULTI_SELECT?Pe(t,r??[]):r?.includes(t)?[]:[t]}function Be(e){return e.length===0?-1:e[0]}function Te(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function Ie(e,t,r){const n=r===l.Style.PILLS?P.PILLS:r===l.Style.BORDERLESS?P.BORDERLESS_ICON:P.SEGMENTED_CONTROL,o=r===l.Style.BORDERLESS?x.XSMALL:x.MEDIUM,i=n===P.PILLS||n===P.SEGMENTED_CONTROL,a=r===l.Style.BORDERLESS?"lg":"base";return{element:E(se,{icon:t,label:e,iconSize:a,useSmallerFont:i}),kind:n,size:o}}function Ae(e,t,r,n){return r.indexOf(n)>-1?!0:t!==l.ClickMode.SINGLE_SELECT||e!==l.SelectionVisualization.ALL_UP_TO_SELECTED?!1:r.length>0&&n<r[0]}function De(e,t){return e&&(t=`${t}Active`),t}function je(e,t,r){const n={flexWrap:"wrap",maxWidth:"100%",margin:"0 0"},o=r?"100%":"auto",i=r?{}:{content:"''",flex:1e4};switch(e){case l.Style.BORDERLESS:return{...n,columnGap:t.threeXS,rowGap:t.threeXS};case l.Style.PILLS:return{...n,columnGap:t.twoXS,rowGap:t.twoXS,width:o};case l.Style.SEGMENTED_CONTROL:return{...n,columnGap:t.none,rowGap:t.twoXS,"::after":i,width:o};default:return n}}function Me(e,t,r,n,o,i,a){const d=Ae(r,n,o,t);let s=e.content,y=e.contentIcon;return d&&(s=e.selectedContent?e.selectedContent:s,y=e.selectedContentIcon?e.selectedContentIcon:y),c.forwardRef(function(h,_){const{element:f,kind:b,size:v}=Ie(s??"",y??void 0,i),m=De(!!(d&&!e.selectedContent&&!e.selectedContentIcon),b);return E(ce,{...h,size:v,kind:m,containerWidth:a,children:f})})}function $e(e,t){return e.getIntArrayValue(t)}function Ge(e){return e.default??null}function Ne(e){return e.value??null}function ze(e){const{disabled:t,element:r,fragmentId:n,widgetMgr:o,widthConfig:i}=e,{clickMode:a,options:d,selectionVisualization:s,style:y,label:g,labelVisibility:h,help:_}=r,f=Y(),[b,v]=fe({getStateFromWidgetMgr:$e,getDefaultStateFromProto:Ge,getCurrStateFromProto:Ne,updateWidgetMgrState:Te,element:r,widgetMgr:o,fragmentId:n}),m=ee(i),T=(R,L)=>{const p=ke(a,L,b);v({value:p,fromUi:!0})};let w;a===l.ClickMode.SINGLE_SELECT?w=k.radio:a===l.ClickMode.MULTI_SELECT&&(w=k.checkbox);const I=c.useMemo(()=>d.map((R,L)=>{const p=Me(R,L,s,a,b,y,m);return E(p,{},`${R.content}-${L}`)}),[a,d,s,y,b,m]);return te(le,{className:"stButtonGroup","data-testid":"stButtonGroup",containerWidth:m,children:[E(ue,{label:g,disabled:t,labelVisibility:re(h?.value??ae.LabelVisibilityOptions.COLLAPSED),children:_&&E(ne,{children:E(oe,{content:_,placement:ie.TOP})})}),E(H,{disabled:t,mode:w,onClick:T,selected:a===l.ClickMode.MULTI_SELECT?b:Be(b),overrides:{Root:{style:c.useCallback(()=>je(y,f.spacing,m),[y,f.spacing,m])}},children:I})]})}const xe=c.memo(ze);export{xe as default};
@@ -0,0 +1 @@
1
+ import{r as y,E as O,_ as T,v as I,t as X,e as F,j as p,an as Q,P as B,b as J,B as K,ao as W,be as L,b0 as Y,a5 as Z,aQ as ee,u as te,a0 as re,bf as ie,bg as oe,x as ne,aR as ae,m as P,bh as se,bi as le,l as de,R as ce,T as ue,W as fe,F as he}from"./index.CD8HuT3N.js";import{U as z}from"./UploadFileInfo.C-jY39rj.js";import{F as pe}from"./FormClearHelper.DHh1GFzm.js";import{P as ge,S as me}from"./ProgressBar.BEY0cXXV.js";var k=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(O,T({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},i,{ref:l}),y.createElement("rect",{width:24,height:24,fill:"none"}),y.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});k.displayName="SwitchCamera";var $=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(O,T({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),y.createElement("path",{d:"M.5 1c-.28 0-.5.23-.5.5v4c0 .28.23.5.5.5h5c.28 0 .5-.22.5-.5V4l1 1h1V2H7L6 3V1.5c0-.28-.22-.5-.5-.5h-5z"}))});$.displayName="Video";var A=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(O,T({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),y.createElement("path",{d:"M1.41 0L0 1.41l.72.72L2.5 3.94.72 5.72 0 6.41l1.41 1.44.72-.72 1.81-1.81 1.78 1.81.69.72 1.44-1.44-.72-.69-1.81-1.78 1.81-1.81.72-.72L6.41 0l-.69.72L3.94 2.5 2.13.72 1.41 0z"}))});A.displayName="X";function ve(i,l){switch(i){case"xsmall":return{padding:`${l.spacing.twoXS} ${l.spacing.sm}`,fontSize:l.fontSizes.sm};case"small":return{padding:`${l.spacing.twoXS} ${l.spacing.md}`};case"large":return{padding:`${l.spacing.md} ${l.spacing.md}`};default:return{padding:`${l.spacing.xs} ${l.spacing.md}`}}}const N=I("div",{target:"etzmx8d0"})({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}),V=I("div",{target:"etzmx8d1"})(({theme:i,width:l})=>({backgroundColor:i.colors.secondaryBg,borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"})),Se=I("p",{target:"etzmx8d2"})(({theme:i})=>({marginTop:i.spacing.sm,textAlign:"center"})),ye=I("img",{target:"etzmx8d3"})(({theme:i,opacity:l})=>({borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,objectFit:"contain",opacity:l})),be=I("a",{target:"etzmx8d4"})(({theme:i})=>({color:i.colors.link,textDecoration:i.linkUnderline?"underline":"none",display:"block"})),Ce=I("span",{target:"etzmx8d5"})({display:"flex",alignItems:"center"}),we=I("div",{target:"etzmx8d6"})(({theme:i})=>({position:"absolute",top:i.spacing.lg,right:i.spacing.lg,zIndex:i.zIndices.priority,color:i.colors.fadedText40,mixBlendMode:"difference",opacity:.6})),Me=I("div",{target:"etzmx8d8"})({height:"fit-content",width:"100%",position:"absolute",bottom:0}),Ue=I("button",{target:"etzmx8d9"})(({theme:i})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:i.colors.lightenedBg05,border:`${i.sizes.borderWidth} solid ${i.colors.borderColor}`,borderRadius:`0 0 ${i.radii.default} ${i.radii.default}`,"&:hover":{borderColor:i.colors.primary,color:i.colors.primary},"&:active":{color:i.colors.white,borderColor:i.colors.primary,backgroundColor:i.colors.primary},"&:focus:not(:active)":{borderColor:i.colors.primary,color:i.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:i.colors.fadedText40,borderColor:i.colors.borderColor,backgroundColor:i.colors.lightenedBg05,cursor:"not-allowed"},fontWeight:i.fontWeights.normal,padding:`${i.spacing.xs} ${i.spacing.md}`,margin:i.spacing.none,lineHeight:i.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${X(i.colors.primary,.5)}`},...ve("medium",i)}));function Ie({disabled:i,onClick:l,children:t,progress:n}){return F(Ue,{disabled:i||!1,onClick:l||(()=>{}),progress:n||null,"data-testid":"stCameraInputButton",children:[t,n?p(Me,{children:p(ge,{value:n,size:me.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const H=y.memo(Ie);var R=function(i){return i.USER="user",i.ENVIRONMENT="environment",i}({});const Ee=({switchFacingMode:i})=>p(we,{"data-testid":"stCameraInputSwitchButton",children:p(Q,{content:"Switch camera",placement:B.TOP_RIGHT,children:p(J,{kind:K.MINIMAL,onClick:i,children:p(W,{content:k,size:"twoXL",color:L.white})})})}),Fe=y.memo(Ee);var _={exports:{}},xe=_.exports,j;function Pe(){return j||(j=1,function(i,l){(function(n,o){i.exports=o(Y())})(xe,function(t){return function(n){var o={};function a(s){if(o[s])return o[s].exports;var f=o[s]={i:s,l:!1,exports:{}};return n[s].call(f.exports,f,f.exports,a),f.l=!0,f.exports}return a.m=n,a.c=o,a.d=function(s,f,g){a.o(s,f)||Object.defineProperty(s,f,{enumerable:!0,get:g})},a.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},a.t=function(s,f){if(f&1&&(s=a(s)),f&8||f&4&&typeof s=="object"&&s&&s.__esModule)return s;var g=Object.create(null);if(a.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:s}),f&2&&typeof s!="string")for(var U in s)a.d(g,U,(function(M){return s[M]}).bind(null,U));return g},a.n=function(s){var f=s&&s.__esModule?function(){return s.default}:function(){return s};return a.d(f,"a",f),f},a.o=function(s,f){return Object.prototype.hasOwnProperty.call(s,f)},a.p="",a(a.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(n,o,a){a.r(o);var s=a("react"),f=function(){var m=function(u,e){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,d){r.__proto__=d}||function(r,d){for(var c in d)d.hasOwnProperty(c)&&(r[c]=d[c])},m(u,e)};return function(u,e){m(u,e);function r(){this.constructor=u}u.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),g=function(){return g=Object.assign||function(m){for(var u,e=1,r=arguments.length;e<r;e++){u=arguments[e];for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(m[d]=u[d])}return m},g.apply(this,arguments)},U=function(m,u){var e={};for(var r in m)Object.prototype.hasOwnProperty.call(m,r)&&u.indexOf(r)<0&&(e[r]=m[r]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,r=Object.getOwnPropertySymbols(m);d<r.length;d++)u.indexOf(r[d])<0&&Object.prototype.propertyIsEnumerable.call(m,r[d])&&(e[r[d]]=m[r[d]]);return e};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(u){var e=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return e?new Promise(function(r,d){e.call(navigator,u,r,d)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function M(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var E=function(m){f(u,m);function u(e){var r=m.call(this,e)||this;return r.canvas=null,r.ctx=null,r.requestUserMediaId=0,r.unmounted=!1,r.state={hasUserMedia:!1},r}return u.prototype.componentDidMount=function(){var e=this,r=e.state,d=e.props;if(this.unmounted=!1,!M()){d.onUserMediaError("getUserMedia not supported");return}r.hasUserMedia||this.requestUserMedia(),d.children&&typeof d.children!="function"&&console.warn("children must be a function")},u.prototype.componentDidUpdate=function(e){var r=this.props;if(!M()){r.onUserMediaError("getUserMedia not supported");return}var d=JSON.stringify(e.audioConstraints)!==JSON.stringify(r.audioConstraints),c=JSON.stringify(e.videoConstraints)!==JSON.stringify(r.videoConstraints),C=e.minScreenshotWidth!==r.minScreenshotWidth,S=e.minScreenshotHeight!==r.minScreenshotHeight;(c||C||S)&&(this.canvas=null,this.ctx=null),(d||c)&&(this.stopAndCleanup(),this.requestUserMedia())},u.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},u.stopMediaStream=function(e){e&&(e.getVideoTracks&&e.getAudioTracks?(e.getVideoTracks().map(function(r){e.removeTrack(r),r.stop()}),e.getAudioTracks().map(function(r){e.removeTrack(r),r.stop()})):e.stop())},u.prototype.stopAndCleanup=function(){var e=this.state;e.hasUserMedia&&(u.stopMediaStream(this.stream),e.src&&window.URL.revokeObjectURL(e.src))},u.prototype.getScreenshot=function(e){var r=this,d=r.state,c=r.props;if(!d.hasUserMedia)return null;var C=this.getCanvas(e);return C&&C.toDataURL(c.screenshotFormat,c.screenshotQuality)},u.prototype.getCanvas=function(e){var r=this,d=r.state,c=r.props;if(!this.video||!d.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var C=this.video.videoWidth,S=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var v=C/S;C=c.minScreenshotWidth||this.video.clientWidth,S=C/v,c.minScreenshotHeight&&S<c.minScreenshotHeight&&(S=c.minScreenshotHeight,C=S*v)}this.canvas=document.createElement("canvas"),this.canvas.width=e?.width||C,this.canvas.height=e?.height||S,this.ctx=this.canvas.getContext("2d")}var w=this,b=w.ctx,h=w.canvas;return b&&h&&(h.width=e?.width||h.width,h.height=e?.height||h.height,c.mirrored&&(b.translate(h.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=c.imageSmoothing,b.drawImage(this.video,0,0,e?.width||h.width,e?.height||h.height),c.mirrored&&(b.scale(-1,1),b.translate(-h.width,0))),h},u.prototype.requestUserMedia=function(){var e=this,r=this.props,d=function(S,v){var w={video:typeof v<"u"?v:!0};r.audio&&(w.audio=typeof S<"u"?S:!0),e.requestUserMediaId++;var b=e.requestUserMediaId;navigator.mediaDevices.getUserMedia(w).then(function(h){e.unmounted||b!==e.requestUserMediaId?u.stopMediaStream(h):e.handleUserMedia(null,h)}).catch(function(h){e.handleUserMedia(h)})};if("mediaDevices"in navigator)d(r.audioConstraints,r.videoConstraints);else{var c=function(S){return{optional:[{sourceId:S}]}},C=function(S){var v=S.deviceId;return typeof v=="string"?v:Array.isArray(v)&&v.length>0?v[0]:typeof v=="object"&&v.ideal?v.ideal:null};MediaStreamTrack.getSources(function(S){var v=null,w=null;S.forEach(function(x){x.kind==="audio"?v=x.id:x.kind==="video"&&(w=x.id)});var b=C(r.audioConstraints);b&&(v=b);var h=C(r.videoConstraints);h&&(w=h),d(c(v),c(w))})}},u.prototype.handleUserMedia=function(e,r){var d=this.props;if(e||!r){this.setState({hasUserMedia:!1}),d.onUserMediaError(e);return}this.stream=r;try{this.video&&(this.video.srcObject=r),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(r)})}d.onUserMedia(r)},u.prototype.render=function(){var e=this,r=this,d=r.state,c=r.props,C=c.audio;c.forceScreenshotSourceSize;var S=c.disablePictureInPicture;c.onUserMedia,c.onUserMediaError,c.screenshotFormat,c.screenshotQuality,c.minScreenshotWidth,c.minScreenshotHeight,c.audioConstraints,c.videoConstraints,c.imageSmoothing;var v=c.mirrored,w=c.style,b=w===void 0?{}:w,h=c.children,x=U(c,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),D=v?g(g({},b),{transform:(b.transform||"")+" scaleX(-1)"}):b,G={getScreenshot:this.getScreenshot.bind(this)};return s.createElement(s.Fragment,null,s.createElement("video",g({autoPlay:!0,disablePictureInPicture:S,src:d.src,muted:!C,playsInline:!0,ref:function(q){e.video=q},style:D},x)),h&&h(G))},u.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},u}(s.Component);o.default=E},react:function(n,o){n.exports=t}}).default})}(_)),_.exports}var Re=Pe();const _e=Z(Re),Oe=({width:i})=>F(V,{width:i,children:[p(W,{size:"threeXL",color:L.gray60,content:$}),F(Se,{children:["This app would like to use your camera.",p(be,{href:ie,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Te=({handleCapture:i,width:l,disabled:t,clearPhotoInProgress:n,setClearPhotoInProgress:o,facingMode:a,setFacingMode:s,testOverride:f})=>{const[g,U]=y.useState(f||"pending"),M=y.useRef(null),[E,m]=y.useState(l),u=y.useCallback(ee(1e3,m),[]);y.useEffect(()=>{u(l)},[l,u]);function e(){if(M.current!==null){const d=M.current.getScreenshot();i(d)}}const r=te();return F(N,{"data-testid":"stCameraInputWebcamComponent",children:[g!=="success"&&!t&&!n?p(Oe,{width:E}):re()&&p(Fe,{switchFacingMode:s}),p(V,{"data-testid":"stCameraInputWebcamStyledBox",hidden:g!=="success"&&!t&&!n,width:E,children:!t&&p(_e,{audio:!1,ref:M,screenshotFormat:"image/jpeg",screenshotQuality:1,width:E,height:E*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{U("error")},onUserMedia:()=>{U("success"),o(!1)},videoConstraints:{width:{ideal:E},facingMode:a}})}),p(H,{onClick:e,disabled:g!=="success"||t||n,children:"Take Photo"})]})},We=y.memo(Te),Ve=150,ze=ne.getLogger("CameraInput");class je extends y.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new pe,this.getProgress=()=>{if(this.state.files.length>0&&this.state.files[this.state.files.length-1].status.type==="uploading")return this.state.files[this.state.files.length-1].status.progress},this.setClearPhotoInProgress=t=>{this.setState({clearPhotoInProgress:t})},this.setFacingMode=()=>{this.setState(t=>({facingMode:t.facingMode===R.USER?R.ENVIRONMENT:R.USER}))},this.handleCapture=t=>{if(t===null)return Promise.resolve();this.setState({imgSrc:t,shutter:!0,minShutterEffectPassed:!1});const n=o=>new Promise(a=>setTimeout(a,o));return Be(t,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(o=>this.props.uploadClient.fetchFileURLs([o]).then(a=>({file:o,fileUrls:a[0]}))).then(({file:o,fileUrls:a})=>this.uploadFile(a,o)).then(()=>n(Ve)).then(()=>{this.setState((o,a)=>({imgSrc:t,shutter:o.shutter,minShutterEffectPassed:!0}))}).catch(o=>{ze.error(o)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(t=>this.deleteFile(t.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const t=this.createWidgetValue(),{element:n,widgetMgr:o,fragmentId:a}=this.props,s=o.getFileUploaderStateValue(n);ae(t,s)||o.setFileUploaderStateValue(n,t,{fromUi:!0},a)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(P(t))return;this.setState({imgSrc:null});const{widgetMgr:n,element:o,fragmentId:a}=this.props;n.setFileUploaderStateValue(o,t,{fromUi:!0},a)})},this.deleteFile=t=>{const n=this.getFile(t);P(n)||(n.status.type==="uploading"&&n.status.abortController.abort(),n.status.type==="uploaded"&&n.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(n.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{this.setState(n=>({files:[...n.files,t]}))},this.removeFile=t=>{this.setState(n=>({files:n.files.filter(o=>o.id!==t)}))},this.getFile=t=>this.state.files.find(n=>n.id===t),this.updateFile=(t,n)=>{this.setState(o=>({files:o.files.map(a=>a.id===t?n:a)}))},this.onUploadComplete=(t,n)=>{this.setState(()=>({shutter:!1}));const o=this.getFile(t);P(o)||o.status.type!=="uploading"||this.updateFile(o.id,o.setStatus({type:"uploaded",fileId:n.fileId,fileUrls:n}))},this.onUploadProgress=(t,n)=>{const o=this.getFile(n);if(P(o)||o.status.type!=="uploading")return;const a=Math.round(t.loaded*100/t.total);o.status.progress!==a&&this.updateFile(n,o.setStatus({type:"uploading",abortController:o.status.abortController,progress:a}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(t,n)=>{const o=new AbortController,a=new z(n.name,n.size,this.nextLocalFileId(),{type:"uploading",abortController:o,progress:1});this.addFile(a),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,n,s=>this.onUploadProgress(s,a.id),o.signal).then(()=>this.onUploadComplete(a.id,t)).catch(s=>{s instanceof DOMException&&s.name==="AbortError"||this.updateFile(a.id,a.setStatus({type:"error",errorMessage:s?s.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:R.USER},{widgetMgr:t,element:n}=this.props,o=t.getFileUploaderStateValue(n);if(P(o))return l;const{uploadedFileInfo:a}=o;return P(a)||a.length===0?l:{files:a.map(s=>{const f=s.name,g=s.size,U=s.fileId,M=s.fileUrls;return new z(f,g,this.nextLocalFileId(),{type:"uploaded",fileId:U,fileUrls:M})}),imgSrc:a.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:R.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=t=>t.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:t,widgetMgr:n,fragmentId:o}=this.props;n.getFileUploaderStateValue(t)===void 0&&n.setFileUploaderStateValue(t,l,{fromUi:!1},o)}createWidgetValue(){const l=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:n,size:o,status:a}=t;return new se({fileId:a.fileId,fileUrls:a.fileUrls,name:n,size:o})});return new le({uploadedFileInfo:l})}render(){const{element:l,widgetMgr:t,disabled:n,width:o}=this.props;return this.formClearHelper.manageFormClearListener(t,l.formId,this.onFormCleared),F(N,{className:"stCameraInput","data-testid":"stCameraInput",children:[p(fe,{label:l.label,disabled:n,labelVisibility:de(l.labelVisibility?.value),children:l.help&&p(ce,{children:p(ue,{content:l.help,placement:B.TOP_RIGHT})})}),this.state.imgSrc?F(he,{children:[p(V,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&p(ye,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:o*9/16})}),p(H,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||n,children:this.getProgress()?"Uploading...":F(Ce,{children:[p(W,{content:A,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):p(We,{handleCapture:this.handleCapture,width:o,disabled:n,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function Be(i,l){return fetch(i).then(t=>t.arrayBuffer()).then(t=>new File([t],l,{type:"image/jpeg"}))}const Ne=oe(je);export{Ne as default};