streamlit 1.51.0__py3-none-any.whl → 1.52.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.
- streamlit/__init__.py +1 -0
- streamlit/commands/execution_control.py +89 -14
- streamlit/components/v1/component_arrow.py +7 -7
- streamlit/components/v2/__init__.py +59 -3
- streamlit/components/v2/bidi_component/main.py +161 -13
- streamlit/components/v2/bidi_component/serialization.py +13 -6
- streamlit/components/v2/component_manager.py +11 -3
- streamlit/components/v2/component_registry.py +18 -1
- streamlit/components/v2/types.py +2 -2
- streamlit/connections/snowflake_connection.py +1 -1
- streamlit/connections/snowpark_connection.py +1 -1
- streamlit/dataframe_util.py +18 -18
- streamlit/delta_generator.py +7 -0
- streamlit/delta_generator_singletons.py +8 -14
- streamlit/elements/alert.py +16 -0
- streamlit/elements/arrow.py +36 -6
- streamlit/elements/bokeh_chart.py +10 -78
- streamlit/elements/code.py +2 -2
- streamlit/elements/deck_gl_json_chart.py +1 -1
- streamlit/elements/exception.py +1 -1
- streamlit/elements/form.py +27 -0
- streamlit/elements/heading.py +60 -5
- streamlit/elements/html.py +13 -2
- streamlit/elements/image.py +1 -1
- streamlit/elements/layouts.py +28 -22
- streamlit/elements/lib/built_in_chart_utils.py +49 -16
- streamlit/elements/lib/color_util.py +1 -1
- streamlit/elements/lib/column_config_utils.py +6 -5
- streamlit/elements/lib/layout_utils.py +50 -0
- streamlit/elements/lib/pandas_styler_utils.py +17 -9
- streamlit/elements/lib/shortcut_utils.py +152 -0
- streamlit/elements/markdown.py +50 -3
- streamlit/elements/metric.py +31 -1
- streamlit/elements/plotly_chart.py +75 -6
- streamlit/elements/spinner.py +1 -1
- streamlit/elements/text.py +20 -3
- streamlit/elements/toast.py +2 -0
- streamlit/elements/vega_charts.py +17 -1
- streamlit/elements/widgets/audio_input.py +8 -7
- streamlit/elements/widgets/button.py +279 -40
- streamlit/elements/widgets/button_group.py +27 -2
- streamlit/elements/widgets/camera_input.py +1 -1
- streamlit/elements/widgets/chat.py +300 -42
- streamlit/elements/widgets/color_picker.py +7 -0
- streamlit/elements/widgets/data_editor.py +68 -28
- streamlit/elements/widgets/file_uploader.py +4 -1
- streamlit/elements/widgets/number_input.py +2 -0
- streamlit/elements/widgets/text_widgets.py +2 -0
- streamlit/elements/widgets/time_widgets.py +581 -9
- streamlit/errors.py +22 -0
- streamlit/git_util.py +1 -1
- streamlit/navigation/page.py +7 -0
- streamlit/net_util.py +2 -2
- streamlit/proto/Alert_pb2.pyi +3 -3
- streamlit/proto/AppPage_pb2.pyi +7 -1
- streamlit/proto/ArrowData_pb2.pyi +7 -1
- streamlit/proto/ArrowNamedDataSet_pb2.pyi +7 -1
- streamlit/proto/ArrowVegaLiteChart_pb2.pyi +7 -1
- streamlit/proto/Arrow_pb2.py +10 -10
- streamlit/proto/Arrow_pb2.pyi +19 -12
- streamlit/proto/AudioInput_pb2.pyi +7 -1
- streamlit/proto/Audio_pb2.pyi +7 -1
- streamlit/proto/AuthRedirect_pb2.pyi +7 -1
- streamlit/proto/AutoRerun_pb2.pyi +7 -1
- streamlit/proto/BackMsg_pb2.py +4 -2
- streamlit/proto/BackMsg_pb2.pyi +34 -4
- streamlit/proto/Balloons_pb2.pyi +7 -1
- streamlit/proto/BidiComponent_pb2.pyi +10 -4
- streamlit/proto/Block_pb2.pyi +35 -35
- streamlit/proto/BokehChart_pb2.pyi +7 -1
- streamlit/proto/ButtonGroup_pb2.pyi +9 -9
- streamlit/proto/Button_pb2.py +2 -2
- streamlit/proto/Button_pb2.pyi +11 -2
- streamlit/proto/CameraInput_pb2.pyi +7 -1
- streamlit/proto/ChatInput_pb2.py +6 -6
- streamlit/proto/ChatInput_pb2.pyi +18 -6
- streamlit/proto/Checkbox_pb2.pyi +3 -3
- streamlit/proto/ClientState_pb2.pyi +10 -4
- streamlit/proto/Code_pb2.pyi +7 -1
- streamlit/proto/ColorPicker_pb2.pyi +7 -1
- streamlit/proto/Common_pb2.py +3 -3
- streamlit/proto/Common_pb2.pyi +35 -23
- streamlit/proto/Components_pb2.pyi +19 -13
- streamlit/proto/DataFrame_pb2.pyi +55 -49
- streamlit/proto/DateInput_pb2.pyi +7 -1
- streamlit/proto/DateTimeInput_pb2.py +28 -0
- streamlit/proto/DateTimeInput_pb2.pyi +92 -0
- streamlit/proto/DeckGlJsonChart_pb2.pyi +3 -3
- streamlit/proto/Delta_pb2.pyi +7 -1
- streamlit/proto/DocString_pb2.pyi +10 -4
- streamlit/proto/DownloadButton_pb2.py +2 -2
- streamlit/proto/DownloadButton_pb2.pyi +16 -2
- streamlit/proto/Element_pb2.py +5 -3
- streamlit/proto/Element_pb2.pyi +23 -5
- streamlit/proto/Empty_pb2.pyi +7 -1
- streamlit/proto/Exception_pb2.pyi +7 -1
- streamlit/proto/Favicon_pb2.pyi +7 -1
- streamlit/proto/FileUploader_pb2.pyi +7 -1
- streamlit/proto/ForwardMsg_pb2.py +12 -10
- streamlit/proto/ForwardMsg_pb2.pyi +42 -15
- streamlit/proto/GapSize_pb2.pyi +4 -4
- streamlit/proto/GitInfo_pb2.pyi +3 -3
- streamlit/proto/GraphVizChart_pb2.pyi +7 -1
- streamlit/proto/Heading_pb2.pyi +7 -1
- streamlit/proto/HeightConfig_pb2.pyi +7 -1
- streamlit/proto/Html_pb2.py +2 -2
- streamlit/proto/Html_pb2.pyi +11 -2
- streamlit/proto/IFrame_pb2.pyi +7 -1
- streamlit/proto/Image_pb2.pyi +10 -4
- streamlit/proto/Json_pb2.pyi +7 -1
- streamlit/proto/LabelVisibilityMessage_pb2.pyi +3 -3
- streamlit/proto/LinkButton_pb2.py +2 -2
- streamlit/proto/LinkButton_pb2.pyi +15 -2
- streamlit/proto/Logo_pb2.pyi +7 -1
- streamlit/proto/Markdown_pb2.pyi +3 -3
- streamlit/proto/Metric_pb2.pyi +7 -7
- streamlit/proto/MetricsEvent_pb2.pyi +10 -4
- streamlit/proto/MultiSelect_pb2.pyi +7 -1
- streamlit/proto/NamedDataSet_pb2.pyi +7 -1
- streamlit/proto/Navigation_pb2.pyi +3 -3
- streamlit/proto/NewSession_pb2.pyi +40 -40
- streamlit/proto/NumberInput_pb2.pyi +3 -3
- streamlit/proto/PageConfig_pb2.pyi +7 -7
- streamlit/proto/PageInfo_pb2.pyi +7 -1
- streamlit/proto/PageLink_pb2.py +2 -2
- streamlit/proto/PageLink_pb2.pyi +11 -2
- streamlit/proto/PageNotFound_pb2.pyi +7 -1
- streamlit/proto/PageProfile_pb2.pyi +13 -7
- streamlit/proto/PagesChanged_pb2.pyi +7 -1
- streamlit/proto/ParentMessage_pb2.pyi +7 -1
- streamlit/proto/PlotlyChart_pb2.pyi +6 -6
- streamlit/proto/Progress_pb2.pyi +7 -1
- streamlit/proto/Radio_pb2.pyi +7 -1
- streamlit/proto/RootContainer_pb2.pyi +1 -1
- streamlit/proto/Selectbox_pb2.pyi +7 -1
- streamlit/proto/SessionEvent_pb2.pyi +7 -1
- streamlit/proto/SessionStatus_pb2.pyi +7 -1
- streamlit/proto/Skeleton_pb2.pyi +3 -3
- streamlit/proto/Slider_pb2.pyi +5 -5
- streamlit/proto/Snow_pb2.pyi +7 -1
- streamlit/proto/Space_pb2.pyi +7 -1
- streamlit/proto/Spinner_pb2.pyi +7 -1
- streamlit/proto/TextAlignmentConfig_pb2.py +29 -0
- streamlit/proto/TextAlignmentConfig_pb2.pyi +68 -0
- streamlit/proto/TextArea_pb2.pyi +7 -1
- streamlit/proto/TextInput_pb2.pyi +3 -3
- streamlit/proto/Text_pb2.pyi +7 -1
- streamlit/proto/TimeInput_pb2.pyi +7 -1
- streamlit/proto/Toast_pb2.pyi +7 -1
- streamlit/proto/VegaLiteChart_pb2.pyi +7 -1
- streamlit/proto/Video_pb2.pyi +6 -6
- streamlit/proto/WidgetStates_pb2.pyi +10 -4
- streamlit/proto/WidthConfig_pb2.pyi +7 -1
- streamlit/proto/openmetrics_data_model_pb2.pyi +52 -52
- streamlit/runtime/app_session.py +38 -1
- streamlit/runtime/caching/cache_data_api.py +1 -1
- streamlit/runtime/caching/cache_resource_api.py +2 -2
- streamlit/runtime/caching/cache_utils.py +1 -1
- streamlit/runtime/caching/hashing.py +1 -1
- streamlit/runtime/download_data_util.py +53 -0
- streamlit/runtime/forward_msg_queue.py +1 -0
- streamlit/runtime/media_file_manager.py +178 -2
- streamlit/runtime/metrics_util.py +87 -3
- streamlit/runtime/scriptrunner/script_runner.py +3 -1
- streamlit/runtime/state/query_params.py +80 -29
- streamlit/runtime/state/session_state.py +2 -2
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +530 -229
- streamlit/static/static/js/{ErrorOutline.esm.YoJdlW1p.js → ErrorOutline.esm.sMJdFExW.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.Ddx8VEYy.js → FileDownload.esm.CV-WYqBn.js} +1 -1
- streamlit/static/static/js/{FileHelper.90EtOmj9.js → FileHelper.5nCh9KDY.js} +3 -3
- streamlit/static/static/js/{FormClearHelper.BB1Km6eP.js → FormClearHelper.-9RbsnV0.js} +1 -1
- streamlit/static/static/js/IFrameUtil.DefezniK.js +1 -0
- streamlit/static/static/js/InputInstructions.2R3tBtW9.js +1 -0
- streamlit/static/static/js/Particles.DDHoXFxh.js +1 -0
- streamlit/static/static/js/{ProgressBar.DLY8H6nE.js → ProgressBar.BxmfHxKu.js} +2 -2
- streamlit/static/static/js/StreamlitSyntaxHighlighter.BFWV0oqR.js +20 -0
- streamlit/static/static/js/{Toolbar.D8nHCkuz.js → Toolbar.DMgU0Vgw.js} +1 -1
- streamlit/static/static/js/_arrayIncludes.B19Iyn2B.js +1 -0
- streamlit/static/static/js/_baseIndexOf.BTknn6Gb.js +1 -0
- streamlit/static/static/js/{base-input.CJGiNqed.js → base-input.BXTqYbyG.js} +4 -4
- streamlit/static/static/js/{checkbox.Cpdd482O.js → checkbox.5xWaqPqm.js} +1 -1
- streamlit/static/static/js/{createSuper.CuQIogbW.js → createSuper.OIgV8wc-.js} +1 -1
- streamlit/static/static/js/data-grid-overlay-editor.B4RIu9cw.js +1 -0
- streamlit/static/static/js/{downloader.CN0K7xlu.js → downloader.DwCJck8O.js} +1 -1
- streamlit/static/static/js/embed.HKcgTiLB.js +195 -0
- streamlit/static/static/js/{es6.BJcsVXQ0.js → es6.4AP97RGk.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.XzUvQqcZ.js → iframeResizer.contentWindow.BZAsvL9q.js} +1 -1
- streamlit/static/static/js/index.-3selq_5.js +2 -0
- streamlit/static/static/js/index.1ylynMAS.js +7 -0
- streamlit/static/static/js/{index.CxIUUfab.js → index.6UunrySF.js} +53 -122
- streamlit/static/static/js/index.8HslT92O.js +14 -0
- streamlit/static/static/js/index.B0TPxAZ1.js +1 -0
- streamlit/static/static/js/index.B0yp3bM1.js +6 -0
- streamlit/static/static/js/index.BHWBaOWH.js +1 -0
- streamlit/static/static/js/index.BJas6XzW.js +1 -0
- streamlit/static/static/js/index.BKIlG7Ng.js +3 -0
- streamlit/static/static/js/index.BMU6zZRk.js +1 -0
- streamlit/static/static/js/index.BNMLO-0p.js +2 -0
- streamlit/static/static/js/index.BPmBNTel.js +1 -0
- streamlit/static/static/js/index.BVuohWM1.js +1 -0
- streamlit/static/static/js/index.B_AvdOKC.js +1 -0
- streamlit/static/static/js/index.BjQIH-3U.js +1 -0
- streamlit/static/static/js/index.BrqtKtSu.js +2 -0
- streamlit/static/static/js/index.Buc7XrOl.js +188 -0
- streamlit/static/static/js/index.CIC9pLsG.js +2 -0
- streamlit/static/static/js/index.CP2YZ73v.js +1 -0
- streamlit/static/static/js/index.CSbah0y4.js +27 -0
- streamlit/static/static/js/index.CbiYVMT1.js +1 -0
- streamlit/static/static/js/index.CbxllBj8.js +1 -0
- streamlit/static/static/js/index.Cd1D2eGF.js +263 -0
- streamlit/static/static/js/index.Ckcqwai8.js +2 -0
- streamlit/static/static/js/index.CqTPbV5Y.js +151 -0
- streamlit/static/static/js/index.CxXo5UKy.js +1 -0
- streamlit/static/static/js/index.CxbL5FgL.js +1 -0
- streamlit/static/static/js/index.D52dMvK5.js +1 -0
- streamlit/static/static/js/index.DBUdji-9.js +3 -0
- streamlit/static/static/js/index.DMU3coc2.js +1 -0
- streamlit/static/static/js/index.DN4sfQLP.js +1 -0
- streamlit/static/static/js/{index.DPUXkcQL.js → index.DRDE9rnx.js} +1 -1
- streamlit/static/static/js/{index.B_dWA3vd.js → index.DY9Ac89e.js} +2 -2
- streamlit/static/static/js/index.DYKCsDvl.js +1 -0
- streamlit/static/static/js/index.Da9gznCC.js +1 -0
- streamlit/static/static/js/index.DfIRibXG.js +1 -0
- streamlit/static/static/js/{index.D3GPA5k4.js → index.Dg5zbEp2.js} +9 -40
- streamlit/static/static/js/index.Di9I2cid.js +1 -0
- streamlit/static/static/js/index.DkpEv0uV.js +1 -0
- streamlit/static/static/js/index.DwJ9Vhsl.js +1 -0
- streamlit/static/static/js/index.L7erTnMm.js +1 -0
- streamlit/static/static/js/{index.DOFlg3dS.js → index.NaDyAN1s.js} +1 -1
- streamlit/static/static/js/index.RNTPpVde.js +1 -0
- streamlit/static/static/js/index.VFDFuf_7.js +1 -0
- streamlit/static/static/js/index.W-bl3NDo.js +1 -0
- streamlit/static/static/js/index.XYozEjwK.js +1 -0
- streamlit/static/static/js/index.oyLQ4pue.js +1 -0
- streamlit/static/static/js/index.q4fLUQtC.js +11 -0
- streamlit/static/static/js/index.q9puCQgK.js +2 -0
- streamlit/static/static/js/index.xZBTXGNC.js +1 -0
- streamlit/static/static/js/{input.D4MN_FzN.js → input.CcvrgErO.js} +2 -2
- streamlit/static/static/js/main.eVHOp4Th.js +13 -0
- streamlit/static/static/js/{memory.DrZjtdGT.js → memory.Ck_sLv5Y.js} +1 -1
- streamlit/static/static/js/moment.C3j7ZXd7.js +4 -0
- streamlit/static/static/js/number-overlay-editor.DgcLMWOy.js +9 -0
- streamlit/static/static/js/pandasStylerUtils.DqP0h70z.js +1 -0
- streamlit/static/static/js/{possibleConstructorReturn.exeeJQEP.js → possibleConstructorReturn.C_51n46K.js} +1 -1
- streamlit/static/static/js/{sandbox.ClO3IuUr.js → sandbox.Q-g3QIZJ.js} +1 -1
- streamlit/static/static/js/styled-components.e0V96rJw.js +1 -0
- streamlit/static/static/js/threshold.Q1mXg5rX.js +1 -0
- streamlit/static/static/js/throttle.D3b5WILl.js +1 -0
- streamlit/static/static/js/{timepicker.DAhu-vcF.js → timepicker.Bpn70xGc.js} +1 -1
- streamlit/static/static/js/timer.C2hYhUse.js +1 -0
- streamlit/static/static/js/{toConsumableArray.DNbljYEC.js → toConsumableArray.DIN_ys1J.js} +1 -1
- streamlit/static/static/js/uniqueId.B27POWT6.js +1 -0
- streamlit/static/static/js/urls.BwSlolu9.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.D6sOH6oI.js → useBasicWidgetState.DA3_qaXD.js} +1 -1
- streamlit/static/static/js/useIntlLocale.BSq6SANa.js +12 -0
- streamlit/static/static/js/{useTextInputAutoExpand.4u3_GcuN.js → useTextInputAutoExpand.ytEW5QmA.js} +1 -1
- streamlit/static/static/js/useUpdateUiValue.DOxWBNiI.js +1 -0
- streamlit/static/static/js/useWaveformController.BCmk6WLk.js +1 -0
- streamlit/static/static/js/value.B4vHRSi7.js +1 -0
- streamlit/static/static/js/withCalculatedWidth.ChdrMItN.js +1 -0
- streamlit/static/static/js/withFullScreenWrapper.7j_lzlaF.js +1 -0
- streamlit/string_util.py +8 -1
- streamlit/testing/v1/app_test.py +15 -0
- streamlit/testing/v1/element_tree.py +62 -0
- streamlit/web/bootstrap.py +24 -0
- streamlit/web/server/oauth_authlib_routes.py +5 -2
- streamlit/web/server/upload_file_request_handler.py +16 -0
- {streamlit-1.51.0.dist-info → streamlit-1.52.1.dist-info}/METADATA +9 -5
- {streamlit-1.51.0.dist-info → streamlit-1.52.1.dist-info}/RECORD +274 -239
- streamlit/static/static/js/InputInstructions.jhH15PqV.js +0 -1
- streamlit/static/static/js/Particles.DUsputn1.js +0 -1
- streamlit/static/static/js/data-grid-overlay-editor.2Ufgxc6y.js +0 -1
- streamlit/static/static/js/index.B1ZQh4P1.js +0 -1
- streamlit/static/static/js/index.BKstZk0M.js +0 -27
- streamlit/static/static/js/index.BMcFsUee.js +0 -1
- streamlit/static/static/js/index.BR-IdcTb.js +0 -2
- streamlit/static/static/js/index.BgnZEMVh.js +0 -1
- streamlit/static/static/js/index.BohqXifI.js +0 -1
- streamlit/static/static/js/index.Br5nxKNj.js +0 -2
- streamlit/static/static/js/index.BrIKVbNc.js +0 -3
- streamlit/static/static/js/index.BtWUPzle.js +0 -1
- streamlit/static/static/js/index.C0RLraek.js +0 -1
- streamlit/static/static/js/index.CAIjskgG.js +0 -1
- streamlit/static/static/js/index.CAj-7vWz.js +0 -949
- streamlit/static/static/js/index.CMtEit2O.js +0 -1
- streamlit/static/static/js/index.CkRlykEE.js +0 -12
- streamlit/static/static/js/index.CmN3FXfI.js +0 -1617
- streamlit/static/static/js/index.CwbFI1_-.js +0 -1
- streamlit/static/static/js/index.D2KPNy7e.js +0 -1
- streamlit/static/static/js/index.DGAh7DMq.js +0 -1
- streamlit/static/static/js/index.DKb_NvmG.js +0 -197
- streamlit/static/static/js/index.DMqgUYKq.js +0 -1
- streamlit/static/static/js/index.DX1xY89g.js +0 -1
- streamlit/static/static/js/index.DYATBCsq.js +0 -2
- streamlit/static/static/js/index.DaSmGJ76.js +0 -3
- streamlit/static/static/js/index.Dd7bMeLP.js +0 -1
- streamlit/static/static/js/index.DjmmgI5U.js +0 -1
- streamlit/static/static/js/index.Dq56CyM2.js +0 -1
- streamlit/static/static/js/index.DuiXaS5_.js +0 -7
- streamlit/static/static/js/index.DvFidMLe.js +0 -2
- streamlit/static/static/js/index.DwkhC5Pc.js +0 -1
- streamlit/static/static/js/index.Q-3sFn1v.js +0 -1
- streamlit/static/static/js/index.QJ5QO9sJ.js +0 -1
- streamlit/static/static/js/index.VwTaeety.js +0 -1
- streamlit/static/static/js/index.YOqQbeX8.js +0 -1
- streamlit/static/static/js/number-overlay-editor.DRwAw1In.js +0 -9
- streamlit/static/static/js/uniqueId.oG4Gvj1v.js +0 -1
- streamlit/static/static/js/useUpdateUiValue.F2R3eTeR.js +0 -1
- streamlit/static/static/js/withFullScreenWrapper.zothJIsI.js +0 -1
- {streamlit-1.51.0.data → streamlit-1.52.1.data}/scripts/streamlit.cmd +0 -0
- {streamlit-1.51.0.dist-info → streamlit-1.52.1.dist-info}/WHEEL +0 -0
- {streamlit-1.51.0.dist-info → streamlit-1.52.1.dist-info}/entry_points.txt +0 -0
- {streamlit-1.51.0.dist-info → streamlit-1.52.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{x as d,r as c,g as m,V as g,W as y,j as t,X as f,k as h}from"./index.CqTPbV5Y.js";import{l as b}from"./index.8HslT92O.js";import{R as u}from"./main.eVHOp4Th.js";const S=d("div",{target:"ec2buac0"})(({theme:o})=>({overflowY:"auto",".react-json-view .copy-icon svg":{fontSize:"1em !important",marginRight:`${o.spacing.threeXS} !important`,verticalAlign:"middle !important"}}));function C({element:o}){const e=m(),{copyToClipboard:n}=g(),i=c.useCallback(a=>{n(JSON.stringify(a.src))},[n]);let s;try{s=JSON.parse(o.body)}catch(a){const r=y(a);try{s=b.parse(o.body)}catch{const l=parseInt(r.message.replace(/[^0-9]/g,""),10);return r.message+=`
|
|
2
|
+
${o.body.substring(0,l+1)} ← here`,t(f,{name:"Json Parse Error",message:r.message})}}const p=h(e)?"rjv-default":"monokai";return t(S,{className:"stJson","data-testid":"stJson",children:t(u,{src:s,collapsed:o.maxExpandDepth??!o.expanded,displayDataTypes:!1,displayObjectSize:!1,name:!1,theme:p,enableClipboard:i,style:{fontFamily:e.genericFonts.codeFont,fontSize:e.fontSizes.codeFontSize,fontWeight:e.fontWeights.code,backgroundColor:e.colors.bgColor,whiteSpace:"pre-wrap"}})})}const v=c.memo(C);export{v as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,L as M,F as T,B as m,u as U,l as I,j as u,b as A,c as j,D as F,a as N,G as Y}from"./index.CqTPbV5Y.js";import{c as R}from"./createDownloadLinkElement.ZaXNnPK4.js";function z(S){const{disabled:a,element:r,widgetMgr:B,endpoints:t,fragmentId:g}=S,{help:v,label:x,icon:L,ignoreRerun:h,type:p,url:k,deferredFileId:n}=r,b=r.shortcut?r.shortcut:void 0,[C,f]=o.useState(!1),[i,s]=o.useState(null),{enforceDownloadInNewTab:d=!1}=o.useContext(M),{requestDeferredFile:D}=o.useContext(T);let w=m.SECONDARY;p==="primary"?w=m.PRIMARY:p==="tertiary"&&(w=m.TERTIARY);const c=o.useMemo(()=>t.buildDownloadUrl(k),[t,k]);o.useEffect(()=>{!!n?.length||t.checkSourceUrlResponse(c,"Download Button")},[c,t,n]);const E=o.useCallback(async()=>{if(!D||!n){s("Deferred download not properly configured");return}f(!0),s(null);try{const e=await D(n);if(e.errorMsg){s(e.errorMsg),f(!1);return}const l=t.buildDownloadUrl(e.url);t.checkSourceUrlResponse(l,"Download Button"),R({filename:"",url:l,enforceDownloadInNewTab:d}).click()}catch(e){const l=e instanceof Error?e.message:"Download failed";s(l)}finally{f(!1)}},[D,n,t,d]),y=o.useCallback(()=>{if(a)return;h||B.setTriggerValue(r,{fromUi:!0},g),!!n?.length?E():R({filename:"",url:c,enforceDownloadInNewTab:d}).click()},[a,h,B,r,g,n,E,c,d]);return U({shortcut:b,disabled:a,onActivate:y}),o.useEffect(()=>{if(i){const e=setTimeout(()=>s(null),5e3);return()=>clearTimeout(e)}},[i]),I("div",{className:"stDownloadButton","data-testid":"stDownloadButton",children:[u(N,{help:v,containerWidth:!0,children:u(A,{kind:w,size:j.SMALL,disabled:a||C,onClick:y,containerWidth:!0,children:u(F,{icon:C?"spinner":L,label:x,shortcut:b})})}),i&&u(Y,{"data-testid":"stDownloadButtonError",children:i})]})}const K=o.memo(z);export{K as default};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import{cH as Rt,cI as _t,cJ as Ot,cK as _e,cL as Mt,cM as Ft,cN as Pt,cO as Bt,cP as Ht,cQ as At,c7 as fe,cR as Tt,cS as $t,al as Ee,ag as Oe,aB as s,r as C,bP as g,bA as _,x as ge,g as Nt,l as qe,j as A,o as Dt,T as jt,P as Lt,ac as zt,cT as Gt,m as Wt}from"./index.CqTPbV5Y.js";import{u as Ut}from"./useBasicWidgetState.DA3_qaXD.js";import{t as It,d as Vt}from"./throttle.D3b5WILl.js";import"./FormClearHelper.-9RbsnV0.js";function xt(r){return typeof r=="function"?r:Rt}function qt(r,e){var t=_e(r)?_t:Ot;return t(r,xt(e))}function $(r,e){var t=_e(r)?Mt:Ft;return t(r,Pt(e))}const Xt=Object.freeze(Object.defineProperty({__proto__:null,default:$},Symbol.toStringTag,{value:"Module"}));function Yt(r,e){return r&&Bt(r,xt(e))}const Kt=Object.freeze(Object.defineProperty({__proto__:null,default:Yt},Symbol.toStringTag,{value:"Module"}));var Zt="[object String]";function Jt(r){return typeof r=="string"||!_e(r)&&Ht(r)&&At(r)==Zt}const Qt=Object.freeze(Object.defineProperty({__proto__:null,default:Jt},Symbol.toStringTag,{value:"Module"}));function Xe(r){return r===void 0}var R={},j={};const er=fe(Qt),Me=fe(Kt),tr=fe(Tt),rr=fe(Xt);var Ye;function nr(){if(Ye)return j;Ye=1,Object.defineProperty(j,"__esModule",{value:!0}),j.flattenNames=void 0;var r=er,e=h(r),t=Me,n=h(t),a=tr,i=h(a),o=rr,l=h(o);function h(p){return p&&p.__esModule?p:{default:p}}var c=j.flattenNames=function p(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],d=[];return(0,l.default)(u,function(f){Array.isArray(f)?p(f).map(function(v){return d.push(v)}):(0,i.default)(f)?(0,n.default)(f,function(v,b){v===!0&&d.push(b),d.push(b+"-"+v)}):(0,e.default)(f)&&d.push(f)}),d};return j.default=c,j}var L={};const ar=fe($t);var Ke;function ir(){if(Ke)return L;Ke=1,Object.defineProperty(L,"__esModule",{value:!0}),L.mergeClasses=void 0;var r=Me,e=i(r),t=ar,n=i(t),a=Object.assign||function(l){for(var h=1;h<arguments.length;h++){var c=arguments[h];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(l[p]=c[p])}return l};function i(l){return l&&l.__esModule?l:{default:l}}var o=L.mergeClasses=function(h){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],p=h.default&&(0,n.default)(h.default)||{};return c.map(function(u){var d=h[u];return d&&(0,e.default)(d,function(f,v){p[v]||(p[v]={}),p[v]=a({},p[v],d[v])}),u}),p};return L.default=o,L}var z={},Ze;function or(){if(Ze)return z;Ze=1,Object.defineProperty(z,"__esModule",{value:!0}),z.autoprefix=void 0;var r=Me,e=n(r),t=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(o[c]=h[c])}return o};function n(o){return o&&o.__esModule?o:{default:o}}var a={borderRadius:function(l){return{msBorderRadius:l,MozBorderRadius:l,OBorderRadius:l,WebkitBorderRadius:l,borderRadius:l}},boxShadow:function(l){return{msBoxShadow:l,MozBoxShadow:l,OBoxShadow:l,WebkitBoxShadow:l,boxShadow:l}},userSelect:function(l){return{WebkitTouchCallout:l,KhtmlUserSelect:l,MozUserSelect:l,msUserSelect:l,WebkitUserSelect:l,userSelect:l}},flex:function(l){return{WebkitBoxFlex:l,MozBoxFlex:l,WebkitFlex:l,msFlex:l,flex:l}},flexBasis:function(l){return{WebkitFlexBasis:l,flexBasis:l}},justifyContent:function(l){return{WebkitJustifyContent:l,justifyContent:l}},transition:function(l){return{msTransition:l,MozTransition:l,OTransition:l,WebkitTransition:l,transition:l}},transform:function(l){return{msTransform:l,MozTransform:l,OTransform:l,WebkitTransform:l,transform:l}},absolute:function(l){var h=l&&l.split(" ");return{position:"absolute",top:h&&h[0],right:h&&h[1],bottom:h&&h[2],left:h&&h[3]}},extend:function(l,h){var c=h[l];return c||{extend:l}}},i=z.autoprefix=function(l){var h={};return(0,e.default)(l,function(c,p){var u={};(0,e.default)(c,function(d,f){var v=a[f];v?u=t({},u,v(d)):u[f]=d}),h[p]=u}),h};return z.default=i,z}var G={},Je;function lr(){if(Je)return G;Je=1,Object.defineProperty(G,"__esModule",{value:!0}),G.hover=void 0;var r=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var u in p)Object.prototype.hasOwnProperty.call(p,u)&&(h[u]=p[u])}return h},e=Ee(),t=n(e);function n(h){return h&&h.__esModule?h:{default:h}}function a(h,c){if(!(h instanceof c))throw new TypeError("Cannot call a class as a function")}function i(h,c){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c&&(typeof c=="object"||typeof c=="function")?c:h}function o(h,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof c);h.prototype=Object.create(c&&c.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),c&&(Object.setPrototypeOf?Object.setPrototypeOf(h,c):h.__proto__=c)}var l=G.hover=function(c){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return function(u){o(d,u);function d(){var f,v,b,m;a(this,d);for(var E=arguments.length,M=Array(E),k=0;k<E;k++)M[k]=arguments[k];return m=(v=(b=i(this,(f=d.__proto__||Object.getPrototypeOf(d)).call.apply(f,[this].concat(M))),b),b.state={hover:!1},b.handleMouseOver=function(){return b.setState({hover:!0})},b.handleMouseOut=function(){return b.setState({hover:!1})},b.render=function(){return t.default.createElement(p,{onMouseOver:b.handleMouseOver,onMouseOut:b.handleMouseOut},t.default.createElement(c,r({},b.props,b.state)))},v),i(b,m)}return d}(t.default.Component)};return G.default=l,G}var W={},Qe;function sr(){if(Qe)return W;Qe=1,Object.defineProperty(W,"__esModule",{value:!0}),W.active=void 0;var r=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var u in p)Object.prototype.hasOwnProperty.call(p,u)&&(h[u]=p[u])}return h},e=Ee(),t=n(e);function n(h){return h&&h.__esModule?h:{default:h}}function a(h,c){if(!(h instanceof c))throw new TypeError("Cannot call a class as a function")}function i(h,c){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c&&(typeof c=="object"||typeof c=="function")?c:h}function o(h,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof c);h.prototype=Object.create(c&&c.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),c&&(Object.setPrototypeOf?Object.setPrototypeOf(h,c):h.__proto__=c)}var l=W.active=function(c){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return function(u){o(d,u);function d(){var f,v,b,m;a(this,d);for(var E=arguments.length,M=Array(E),k=0;k<E;k++)M[k]=arguments[k];return m=(v=(b=i(this,(f=d.__proto__||Object.getPrototypeOf(d)).call.apply(f,[this].concat(M))),b),b.state={active:!1},b.handleMouseDown=function(){return b.setState({active:!0})},b.handleMouseUp=function(){return b.setState({active:!1})},b.render=function(){return t.default.createElement(p,{onMouseDown:b.handleMouseDown,onMouseUp:b.handleMouseUp},t.default.createElement(c,r({},b.props,b.state)))},v),i(b,m)}return d}(t.default.Component)};return W.default=l,W}var xe={},et;function hr(){if(et)return xe;et=1,Object.defineProperty(xe,"__esModule",{value:!0});var r=function(t,n){var a={},i=function(l){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;a[l]=h};return t===0&&i("first-child"),t===n-1&&i("last-child"),(t===0||t%2===0)&&i("even"),Math.abs(t%2)===1&&i("odd"),i("nth-child",t),a};return xe.default=r,xe}var tt;function cr(){if(tt)return R;tt=1,Object.defineProperty(R,"__esModule",{value:!0}),R.ReactCSS=R.loop=R.handleActive=R.handleHover=R.hover=void 0;var r=nr(),e=d(r),t=ir(),n=d(t),a=or(),i=d(a),o=lr(),l=d(o),h=sr(),c=d(h),p=hr(),u=d(p);function d(v){return v&&v.__esModule?v:{default:v}}R.hover=l.default,R.handleHover=l.default,R.handleActive=c.default,R.loop=u.default;var f=R.ReactCSS=function(b){for(var m=arguments.length,E=Array(m>1?m-1:0),M=1;M<m;M++)E[M-1]=arguments[M];var k=(0,e.default)(E),T=(0,n.default)(b,k);return(0,i.default)(T)};return R.default=f,R}var Fe=cr();const y=Oe(Fe);var pr=function(e,t,n,a,i){var o=i.clientWidth,l=i.clientHeight,h=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,c=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,p=h-(i.getBoundingClientRect().left+window.pageXOffset),u=c-(i.getBoundingClientRect().top+window.pageYOffset);if(n==="vertical"){var d=void 0;if(u<0?d=0:u>l?d=1:d=Math.round(u*100/l)/100,t.a!==d)return{h:t.h,s:t.s,l:t.l,a:d,source:"rgb"}}else{var f=void 0;if(p<0?f=0:p>o?f=1:f=Math.round(p*100/o)/100,a!==f)return{h:t.h,s:t.s,l:t.l,a:f,source:"rgb"}}return null},Ce={},ur=function(e,t,n,a){if(typeof document>"u"&&!a)return null;var i=a?new a:document.createElement("canvas");i.width=n*2,i.height=n*2;var o=i.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,i.width,i.height),o.fillStyle=t,o.fillRect(0,0,n,n),o.translate(n,n),o.fillRect(0,0,n,n),i.toDataURL()):null},dr=function(e,t,n,a){var i=e+"-"+t+"-"+n+(a?"-server":"");if(Ce[i])return Ce[i];var o=ur(e,t,n,a);return Ce[i]=o,o},rt=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},le=function(e){var t=e.white,n=e.grey,a=e.size,i=e.renderers,o=e.borderRadius,l=e.boxShadow,h=e.children,c=y({default:{grid:{borderRadius:o,boxShadow:l,absolute:"0px 0px 0px 0px",background:"url("+dr(t,n,a,i.canvas)+") center left"}}});return C.isValidElement(h)?s.cloneElement(h,rt({},h.props,{style:rt({},h.props.style,c.grid)})):s.createElement("div",{style:c.grid})};le.defaultProps={size:8,white:"transparent",grey:"rgba(0,0,0,.08)",renderers:{}};var fr=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},gr=function(){function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function br(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function nt(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function vr(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Pe=function(r){vr(e,r);function e(){var t,n,a,i;br(this,e);for(var o=arguments.length,l=Array(o),h=0;h<o;h++)l[h]=arguments[h];return i=(n=(a=nt(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(l))),a),a.handleChange=function(c){var p=pr(c,a.props.hsl,a.props.direction,a.props.a,a.container);p&&typeof a.props.onChange=="function"&&a.props.onChange(p,c)},a.handleMouseDown=function(c){a.handleChange(c),window.addEventListener("mousemove",a.handleChange),window.addEventListener("mouseup",a.handleMouseUp)},a.handleMouseUp=function(){a.unbindEventListeners()},a.unbindEventListeners=function(){window.removeEventListener("mousemove",a.handleChange),window.removeEventListener("mouseup",a.handleMouseUp)},n),nt(a,i)}return gr(e,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"render",value:function(){var n=this,a=this.props.rgb,i=y({default:{alpha:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},checkboard:{absolute:"0px 0px 0px 0px",overflow:"hidden",borderRadius:this.props.radius},gradient:{absolute:"0px 0px 0px 0px",background:"linear-gradient(to right, rgba("+a.r+","+a.g+","+a.b+`, 0) 0%,
|
|
2
|
+
rgba(`+a.r+","+a.g+","+a.b+", 1) 100%)",boxShadow:this.props.shadow,borderRadius:this.props.radius},container:{position:"relative",height:"100%",margin:"0 3px"},pointer:{position:"absolute",left:a.a*100+"%"},slider:{width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",marginTop:"1px",transform:"translateX(-2px)"}},vertical:{gradient:{background:"linear-gradient(to bottom, rgba("+a.r+","+a.g+","+a.b+`, 0) 0%,
|
|
3
|
+
rgba(`+a.r+","+a.g+","+a.b+", 1) 100%)"},pointer:{left:0,top:a.a*100+"%"}},overwrite:fr({},this.props.style)},{vertical:this.props.direction==="vertical",overwrite:!0});return s.createElement("div",{style:i.alpha},s.createElement("div",{style:i.checkboard},s.createElement(le,{renderers:this.props.renderers})),s.createElement("div",{style:i.gradient}),s.createElement("div",{style:i.container,ref:function(l){return n.container=l},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},s.createElement("div",{style:i.pointer},this.props.pointer?s.createElement(this.props.pointer,this.props):s.createElement("div",{style:i.slider}))))}}]),e}(C.PureComponent||C.Component),xr=function(){function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function mr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yr(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function wr(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function Er(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Sr=1,mt=38,Cr=40,kr=[mt,Cr],Rr=function(e){return kr.indexOf(e)>-1},_r=function(e){return Number(String(e).replace(/%/g,""))},Or=1,w=function(r){Er(e,r);function e(t){yr(this,e);var n=wr(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return n.handleBlur=function(){n.state.blurValue&&n.setState({value:n.state.blurValue,blurValue:null})},n.handleChange=function(a){n.setUpdatedValue(a.target.value,a)},n.handleKeyDown=function(a){var i=_r(a.target.value);if(!isNaN(i)&&Rr(a.keyCode)){var o=n.getArrowOffset(),l=a.keyCode===mt?i+o:i-o;n.setUpdatedValue(l,a)}},n.handleDrag=function(a){if(n.props.dragLabel){var i=Math.round(n.props.value+a.movementX);i>=0&&i<=n.props.dragMax&&n.props.onChange&&n.props.onChange(n.getValueObjectWithLabel(i),a)}},n.handleMouseDown=function(a){n.props.dragLabel&&(a.preventDefault(),n.handleDrag(a),window.addEventListener("mousemove",n.handleDrag),window.addEventListener("mouseup",n.handleMouseUp))},n.handleMouseUp=function(){n.unbindEventListeners()},n.unbindEventListeners=function(){window.removeEventListener("mousemove",n.handleDrag),window.removeEventListener("mouseup",n.handleMouseUp)},n.state={value:String(t.value).toUpperCase(),blurValue:String(t.value).toUpperCase()},n.inputId="rc-editable-input-"+Or++,n}return xr(e,[{key:"componentDidUpdate",value:function(n,a){this.props.value!==this.state.value&&(n.value!==this.props.value||a.value!==this.state.value)&&(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(n){return mr({},this.props.label,n)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||Sr}},{key:"setUpdatedValue",value:function(n,a){var i=this.props.label?this.getValueObjectWithLabel(n):n;this.props.onChange&&this.props.onChange(i,a),this.setState({value:n})}},{key:"render",value:function(){var n=this,a=y({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return s.createElement("div",{style:a.wrap},s.createElement("input",{id:this.inputId,style:a.input,ref:function(o){return n.input=o},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?s.createElement("label",{htmlFor:this.inputId,style:a.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e}(C.PureComponent||C.Component),Mr=function(e,t,n,a){var i=a.clientWidth,o=a.clientHeight,l=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,h=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=l-(a.getBoundingClientRect().left+window.pageXOffset),p=h-(a.getBoundingClientRect().top+window.pageYOffset);if(t==="vertical"){var u=void 0;if(p<0)u=359;else if(p>o)u=0;else{var d=-(p*100/o)+100;u=360*d/100}if(n.h!==u)return{h:u,s:n.s,l:n.l,a:n.a,source:"hsl"}}else{var f=void 0;if(c<0)f=0;else if(c>i)f=359;else{var v=c*100/i;f=360*v/100}if(n.h!==f)return{h:f,s:n.s,l:n.l,a:n.a,source:"hsl"}}return null},Fr=function(){function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function Pr(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function at(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function Br(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var se=function(r){Br(e,r);function e(){var t,n,a,i;Pr(this,e);for(var o=arguments.length,l=Array(o),h=0;h<o;h++)l[h]=arguments[h];return i=(n=(a=at(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(l))),a),a.handleChange=function(c){var p=Mr(c,a.props.direction,a.props.hsl,a.container);p&&typeof a.props.onChange=="function"&&a.props.onChange(p,c)},a.handleMouseDown=function(c){a.handleChange(c),window.addEventListener("mousemove",a.handleChange),window.addEventListener("mouseup",a.handleMouseUp)},a.handleMouseUp=function(){a.unbindEventListeners()},n),at(a,i)}return Fr(e,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"unbindEventListeners",value:function(){window.removeEventListener("mousemove",this.handleChange),window.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function(){var n=this,a=this.props.direction,i=a===void 0?"horizontal":a,o=y({default:{hue:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius,boxShadow:this.props.shadow},container:{padding:"0 2px",position:"relative",height:"100%",borderRadius:this.props.radius},pointer:{position:"absolute",left:this.props.hsl.h*100/360+"%"},slider:{marginTop:"1px",width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",transform:"translateX(-2px)"}},vertical:{pointer:{left:"0px",top:-(this.props.hsl.h*100/360)+100+"%"}}},{vertical:i==="vertical"});return s.createElement("div",{style:o.hue},s.createElement("div",{className:"hue-"+i,style:o.container,ref:function(h){return n.container=h},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},s.createElement("style",null,`
|
|
4
|
+
.hue-horizontal {
|
|
5
|
+
background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0
|
|
6
|
+
33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
|
|
7
|
+
background: -webkit-linear-gradient(to right, #f00 0%, #ff0
|
|
8
|
+
17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.hue-vertical {
|
|
12
|
+
background: linear-gradient(to top, #f00 0%, #ff0 17%, #0f0 33%,
|
|
13
|
+
#0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
|
|
14
|
+
background: -webkit-linear-gradient(to top, #f00 0%, #ff0 17%,
|
|
15
|
+
#0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
|
|
16
|
+
}
|
|
17
|
+
`),s.createElement("div",{style:o.pointer},this.props.pointer?s.createElement(this.props.pointer,this.props):s.createElement("div",{style:o.slider}))))}}]),e}(C.PureComponent||C.Component),be=function(e){var t=e.zDepth,n=e.radius,a=e.background,i=e.children,o=e.styles,l=o===void 0?{}:o,h=y(_({default:{wrap:{position:"relative",display:"inline-block"},content:{position:"relative"},bg:{absolute:"0px 0px 0px 0px",boxShadow:"0 "+t+"px "+t*4+"px rgba(0,0,0,.24)",borderRadius:n,background:a}},"zDepth-0":{bg:{boxShadow:"none"}},"zDepth-1":{bg:{boxShadow:"0 2px 10px rgba(0,0,0,.12), 0 2px 5px rgba(0,0,0,.16)"}},"zDepth-2":{bg:{boxShadow:"0 6px 20px rgba(0,0,0,.19), 0 8px 17px rgba(0,0,0,.2)"}},"zDepth-3":{bg:{boxShadow:"0 17px 50px rgba(0,0,0,.19), 0 12px 15px rgba(0,0,0,.24)"}},"zDepth-4":{bg:{boxShadow:"0 25px 55px rgba(0,0,0,.21), 0 16px 28px rgba(0,0,0,.22)"}},"zDepth-5":{bg:{boxShadow:"0 40px 77px rgba(0,0,0,.22), 0 27px 24px rgba(0,0,0,.2)"}},square:{bg:{borderRadius:"0"}},circle:{bg:{borderRadius:"50%"}}},l),{"zDepth-1":t===1});return s.createElement("div",{style:h.wrap},s.createElement("div",{style:h.bg}),s.createElement("div",{style:h.content},i))};be.propTypes={background:g.string,zDepth:g.oneOf([0,1,2,3,4,5]),radius:g.number,styles:g.object};be.defaultProps={background:"#fff",zDepth:1,radius:2,styles:{}};var Hr=function(e,t,n){var a=n.getBoundingClientRect(),i=a.width,o=a.height,l=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,h=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=l-(n.getBoundingClientRect().left+window.pageXOffset),p=h-(n.getBoundingClientRect().top+window.pageYOffset);c<0?c=0:c>i&&(c=i),p<0?p=0:p>o&&(p=o);var u=c/i,d=1-p/o;return{h:t.h,s:u,v:d,a:t.a,source:"hsv"}},Ar=function(){function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function Tr(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function $r(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function Nr(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var ve=function(r){Nr(e,r);function e(t){Tr(this,e);var n=$r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.handleChange=function(a){typeof n.props.onChange=="function"&&n.throttle(n.props.onChange,Hr(a,n.props.hsl,n.container),a)},n.handleMouseDown=function(a){n.handleChange(a);var i=n.getContainerRenderWindow();i.addEventListener("mousemove",n.handleChange),i.addEventListener("mouseup",n.handleMouseUp)},n.handleMouseUp=function(){n.unbindEventListeners()},n.throttle=It(function(a,i,o){a(i,o)},50),n}return Ar(e,[{key:"componentWillUnmount",value:function(){this.throttle.cancel(),this.unbindEventListeners()}},{key:"getContainerRenderWindow",value:function(){for(var n=this.container,a=window;!a.document.contains(n)&&a.parent!==a;)a=a.parent;return a}},{key:"unbindEventListeners",value:function(){var n=this.getContainerRenderWindow();n.removeEventListener("mousemove",this.handleChange),n.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function(){var n=this,a=this.props.style||{},i=a.color,o=a.white,l=a.black,h=a.pointer,c=a.circle,p=y({default:{color:{absolute:"0px 0px 0px 0px",background:"hsl("+this.props.hsl.h+",100%, 50%)",borderRadius:this.props.radius},white:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},black:{absolute:"0px 0px 0px 0px",boxShadow:this.props.shadow,borderRadius:this.props.radius},pointer:{position:"absolute",top:-(this.props.hsv.v*100)+100+"%",left:this.props.hsv.s*100+"%",cursor:"default"},circle:{width:"4px",height:"4px",boxShadow:`0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0,0,0,.3),
|
|
18
|
+
0 0 1px 2px rgba(0,0,0,.4)`,borderRadius:"50%",cursor:"hand",transform:"translate(-2px, -2px)"}},custom:{color:i,white:o,black:l,pointer:h,circle:c}},{custom:!!this.props.style});return s.createElement("div",{style:p.color,ref:function(d){return n.container=d},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},s.createElement("style",null,`
|
|
19
|
+
.saturation-white {
|
|
20
|
+
background: -webkit-linear-gradient(to right, #fff, rgba(255,255,255,0));
|
|
21
|
+
background: linear-gradient(to right, #fff, rgba(255,255,255,0));
|
|
22
|
+
}
|
|
23
|
+
.saturation-black {
|
|
24
|
+
background: -webkit-linear-gradient(to top, #000, rgba(0,0,0,0));
|
|
25
|
+
background: linear-gradient(to top, #000, rgba(0,0,0,0));
|
|
26
|
+
}
|
|
27
|
+
`),s.createElement("div",{style:p.white,className:"saturation-white"},s.createElement("div",{style:p.black,className:"saturation-black"}),s.createElement("div",{style:p.pointer},this.props.pointer?s.createElement(this.props.pointer,this.props):s.createElement("div",{style:p.circle}))))}}]),e}(C.PureComponent||C.Component);function we(r){"@babel/helpers - typeof";return we=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},we(r)}var Dr=/^\s+/,jr=/\s+$/;function x(r,e){if(r=r||"",e=e||{},r instanceof x)return r;if(!(this instanceof x))return new x(r,e);var t=Lr(r);this._originalInput=r,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=t.ok}x.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,n,a,i,o,l;return t=e.r/255,n=e.g/255,a=e.b/255,t<=.03928?i=t/12.92:i=Math.pow((t+.055)/1.055,2.4),n<=.03928?o=n/12.92:o=Math.pow((n+.055)/1.055,2.4),a<=.03928?l=a/12.92:l=Math.pow((a+.055)/1.055,2.4),.2126*i+.7152*o+.0722*l},setAlpha:function(e){return this._a=yt(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=ot(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=ot(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),a=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+a+"%)":"hsva("+t+", "+n+"%, "+a+"%, "+this._roundA+")"},toHsl:function(){var e=it(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=it(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),a=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+n+"%, "+a+"%)":"hsla("+t+", "+n+"%, "+a+"%, "+this._roundA+")"},toHex:function(e){return lt(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return Ur(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(S(this._r,255)*100)+"%",g:Math.round(S(this._g,255)*100)+"%",b:Math.round(S(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(S(this._r,255)*100)+"%, "+Math.round(S(this._g,255)*100)+"%, "+Math.round(S(this._b,255)*100)+"%)":"rgba("+Math.round(S(this._r,255)*100)+"%, "+Math.round(S(this._g,255)*100)+"%, "+Math.round(S(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:rn[lt(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+st(this._r,this._g,this._b,this._a),n=t,a=this._gradientType?"GradientType = 1, ":"";if(e){var i=x(e);n="#"+st(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,a=this._a<1&&this._a>=0,i=!t&&a&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return i?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return x(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(Xr,arguments)},brighten:function(){return this._applyModification(Yr,arguments)},darken:function(){return this._applyModification(Kr,arguments)},desaturate:function(){return this._applyModification(Ir,arguments)},saturate:function(){return this._applyModification(Vr,arguments)},greyscale:function(){return this._applyModification(qr,arguments)},spin:function(){return this._applyModification(Zr,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(en,arguments)},complement:function(){return this._applyCombination(Jr,arguments)},monochromatic:function(){return this._applyCombination(tn,arguments)},splitcomplement:function(){return this._applyCombination(Qr,arguments)},triad:function(){return this._applyCombination(ht,[3])},tetrad:function(){return this._applyCombination(ht,[4])}};x.fromRatio=function(r,e){if(we(r)=="object"){var t={};for(var n in r)r.hasOwnProperty(n)&&(n==="a"?t[n]=r[n]:t[n]=pe(r[n]));r=t}return x(r,e)};function Lr(r){var e={r:0,g:0,b:0},t=1,n=null,a=null,i=null,o=!1,l=!1;return typeof r=="string"&&(r=ln(r)),we(r)=="object"&&(H(r.r)&&H(r.g)&&H(r.b)?(e=zr(r.r,r.g,r.b),o=!0,l=String(r.r).substr(-1)==="%"?"prgb":"rgb"):H(r.h)&&H(r.s)&&H(r.v)?(n=pe(r.s),a=pe(r.v),e=Wr(r.h,n,a),o=!0,l="hsv"):H(r.h)&&H(r.s)&&H(r.l)&&(n=pe(r.s),i=pe(r.l),e=Gr(r.h,n,i),o=!0,l="hsl"),r.hasOwnProperty("a")&&(t=r.a)),t=yt(t),{ok:o,format:r.format||l,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function zr(r,e,t){return{r:S(r,255)*255,g:S(e,255)*255,b:S(t,255)*255}}function it(r,e,t){r=S(r,255),e=S(e,255),t=S(t,255);var n=Math.max(r,e,t),a=Math.min(r,e,t),i,o,l=(n+a)/2;if(n==a)i=o=0;else{var h=n-a;switch(o=l>.5?h/(2-n-a):h/(n+a),n){case r:i=(e-t)/h+(e<t?6:0);break;case e:i=(t-r)/h+2;break;case t:i=(r-e)/h+4;break}i/=6}return{h:i,s:o,l}}function Gr(r,e,t){var n,a,i;r=S(r,360),e=S(e,100),t=S(t,100);function o(c,p,u){return u<0&&(u+=1),u>1&&(u-=1),u<1/6?c+(p-c)*6*u:u<1/2?p:u<2/3?c+(p-c)*(2/3-u)*6:c}if(e===0)n=a=i=t;else{var l=t<.5?t*(1+e):t+e-t*e,h=2*t-l;n=o(h,l,r+1/3),a=o(h,l,r),i=o(h,l,r-1/3)}return{r:n*255,g:a*255,b:i*255}}function ot(r,e,t){r=S(r,255),e=S(e,255),t=S(t,255);var n=Math.max(r,e,t),a=Math.min(r,e,t),i,o,l=n,h=n-a;if(o=n===0?0:h/n,n==a)i=0;else{switch(n){case r:i=(e-t)/h+(e<t?6:0);break;case e:i=(t-r)/h+2;break;case t:i=(r-e)/h+4;break}i/=6}return{h:i,s:o,v:l}}function Wr(r,e,t){r=S(r,360)*6,e=S(e,100),t=S(t,100);var n=Math.floor(r),a=r-n,i=t*(1-e),o=t*(1-a*e),l=t*(1-(1-a)*e),h=n%6,c=[t,o,i,i,l,t][h],p=[l,t,t,o,i,i][h],u=[i,i,l,t,t,o][h];return{r:c*255,g:p*255,b:u*255}}function lt(r,e,t,n){var a=[B(Math.round(r).toString(16)),B(Math.round(e).toString(16)),B(Math.round(t).toString(16))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0):a.join("")}function Ur(r,e,t,n,a){var i=[B(Math.round(r).toString(16)),B(Math.round(e).toString(16)),B(Math.round(t).toString(16)),B(wt(n))];return a&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0):i.join("")}function st(r,e,t,n){var a=[B(wt(n)),B(Math.round(r).toString(16)),B(Math.round(e).toString(16)),B(Math.round(t).toString(16))];return a.join("")}x.equals=function(r,e){return!r||!e?!1:x(r).toRgbString()==x(e).toRgbString()};x.random=function(){return x.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Ir(r,e){e=e===0?0:e||10;var t=x(r).toHsl();return t.s-=e/100,t.s=Se(t.s),x(t)}function Vr(r,e){e=e===0?0:e||10;var t=x(r).toHsl();return t.s+=e/100,t.s=Se(t.s),x(t)}function qr(r){return x(r).desaturate(100)}function Xr(r,e){e=e===0?0:e||10;var t=x(r).toHsl();return t.l+=e/100,t.l=Se(t.l),x(t)}function Yr(r,e){e=e===0?0:e||10;var t=x(r).toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(e/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(e/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(e/100)))),x(t)}function Kr(r,e){e=e===0?0:e||10;var t=x(r).toHsl();return t.l-=e/100,t.l=Se(t.l),x(t)}function Zr(r,e){var t=x(r).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,x(t)}function Jr(r){var e=x(r).toHsl();return e.h=(e.h+180)%360,x(e)}function ht(r,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=x(r).toHsl(),n=[x(r)],a=360/e,i=1;i<e;i++)n.push(x({h:(t.h+i*a)%360,s:t.s,l:t.l}));return n}function Qr(r){var e=x(r).toHsl(),t=e.h;return[x(r),x({h:(t+72)%360,s:e.s,l:e.l}),x({h:(t+216)%360,s:e.s,l:e.l})]}function en(r,e,t){e=e||6,t=t||30;var n=x(r).toHsl(),a=360/t,i=[x(r)];for(n.h=(n.h-(a*e>>1)+720)%360;--e;)n.h=(n.h+a)%360,i.push(x(n));return i}function tn(r,e){e=e||6;for(var t=x(r).toHsv(),n=t.h,a=t.s,i=t.v,o=[],l=1/e;e--;)o.push(x({h:n,s:a,v:i})),i=(i+l)%1;return o}x.mix=function(r,e,t){t=t===0?0:t||50;var n=x(r).toRgb(),a=x(e).toRgb(),i=t/100,o={r:(a.r-n.r)*i+n.r,g:(a.g-n.g)*i+n.g,b:(a.b-n.b)*i+n.b,a:(a.a-n.a)*i+n.a};return x(o)};x.readability=function(r,e){var t=x(r),n=x(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};x.isReadable=function(r,e,t){var n=x.readability(r,e),a,i;switch(i=!1,a=sn(t),a.level+a.size){case"AAsmall":case"AAAlarge":i=n>=4.5;break;case"AAlarge":i=n>=3;break;case"AAAsmall":i=n>=7;break}return i};x.mostReadable=function(r,e,t){var n=null,a=0,i,o,l,h;t=t||{},o=t.includeFallbackColors,l=t.level,h=t.size;for(var c=0;c<e.length;c++)i=x.readability(r,e[c]),i>a&&(a=i,n=x(e[c]));return x.isReadable(r,n,{level:l,size:h})||!o?n:(t.includeFallbackColors=!1,x.mostReadable(r,["#fff","#000"],t))};var Re=x.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},rn=x.hexNames=nn(Re);function nn(r){var e={};for(var t in r)r.hasOwnProperty(t)&&(e[r[t]]=t);return e}function yt(r){return r=parseFloat(r),(isNaN(r)||r<0||r>1)&&(r=1),r}function S(r,e){an(r)&&(r="100%");var t=on(r);return r=Math.min(e,Math.max(0,parseFloat(r))),t&&(r=parseInt(r*e,10)/100),Math.abs(r-e)<1e-6?1:r%e/parseFloat(e)}function Se(r){return Math.min(1,Math.max(0,r))}function F(r){return parseInt(r,16)}function an(r){return typeof r=="string"&&r.indexOf(".")!=-1&&parseFloat(r)===1}function on(r){return typeof r=="string"&&r.indexOf("%")!=-1}function B(r){return r.length==1?"0"+r:""+r}function pe(r){return r<=1&&(r=r*100+"%"),r}function wt(r){return Math.round(parseFloat(r)*255).toString(16)}function ct(r){return F(r)/255}var P=function(){var r="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+r+")",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",a="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+a),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function H(r){return!!P.CSS_UNIT.exec(r)}function ln(r){r=r.replace(Dr,"").replace(jr,"").toLowerCase();var e=!1;if(Re[r])r=Re[r],e=!0;else if(r=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=P.rgb.exec(r))?{r:t[1],g:t[2],b:t[3]}:(t=P.rgba.exec(r))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=P.hsl.exec(r))?{h:t[1],s:t[2],l:t[3]}:(t=P.hsla.exec(r))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=P.hsv.exec(r))?{h:t[1],s:t[2],v:t[3]}:(t=P.hsva.exec(r))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=P.hex8.exec(r))?{r:F(t[1]),g:F(t[2]),b:F(t[3]),a:ct(t[4]),format:e?"name":"hex8"}:(t=P.hex6.exec(r))?{r:F(t[1]),g:F(t[2]),b:F(t[3]),format:e?"name":"hex"}:(t=P.hex4.exec(r))?{r:F(t[1]+""+t[1]),g:F(t[2]+""+t[2]),b:F(t[3]+""+t[3]),a:ct(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=P.hex3.exec(r))?{r:F(t[1]+""+t[1]),g:F(t[2]+""+t[2]),b:F(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function sn(r){var e,t;return r=r||{level:"AA",size:"small"},e=(r.level||"AA").toUpperCase(),t=(r.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}var pt=function(e){var t=["r","g","b","a","h","s","l","v"],n=0,a=0;return qt(t,function(i){if(e[i]&&(n+=1,isNaN(e[i])||(a+=1),i==="s"||i==="l")){var o=/^\d+%$/;o.test(e[i])&&(a+=1)}}),n===a?e:!1},ue=function(e,t){var n=e.hex?x(e.hex):x(e),a=n.toHsl(),i=n.toHsv(),o=n.toRgb(),l=n.toHex();a.s===0&&(a.h=t||0,i.h=t||0);var h=l==="000000"&&o.a===0;return{hsl:a,hex:h?"transparent":"#"+l,rgb:o,hsv:i,oldHue:e.h||t||a.h,source:e.source}},N=function(e){if(e==="transparent")return!0;var t=String(e).charAt(0)==="#"?1:0;return e.length!==4+t&&e.length<7+t&&x(e).isValid()},Be=function(e){if(!e)return"#fff";var t=ue(e);if(t.hex==="transparent")return"rgba(0,0,0,0.4)";var n=(t.rgb.r*299+t.rgb.g*587+t.rgb.b*114)/1e3;return n>=128?"#000":"#fff"},ke=function(e,t){var n=e.replace("°","");return x(t+" ("+n+")")._ok},he=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},hn=function(){function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function cn(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function pn(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function un(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var O=function(e){var t=function(n){un(a,n);function a(i){cn(this,a);var o=pn(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));return o.handleChange=function(l,h){var c=pt(l);if(c){var p=ue(l,l.h||o.state.oldHue);o.setState(p),o.props.onChangeComplete&&o.debounce(o.props.onChangeComplete,p,h),o.props.onChange&&o.props.onChange(p,h)}},o.handleSwatchHover=function(l,h){var c=pt(l);if(c){var p=ue(l,l.h||o.state.oldHue);o.props.onSwatchHover&&o.props.onSwatchHover(p,h)}},o.state=he({},ue(i.color,0)),o.debounce=Vt(function(l,h,c){l(h,c)},100),o}return hn(a,[{key:"render",value:function(){var o={};return this.props.onSwatchHover&&(o.onSwatchHover=this.handleSwatchHover),s.createElement(e,he({},this.props,this.state,{onChange:this.handleChange},o))}}],[{key:"getDerivedStateFromProps",value:function(o,l){return he({},ue(o.color,l.oldHue))}}]),a}(C.PureComponent||C.Component);return t.propTypes=he({},e.propTypes),t.defaultProps=he({},e.defaultProps,{color:{h:250,s:.5,l:.2,a:1}}),t},dn=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},fn=function(){function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function gn(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function ut(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function bn(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var vn=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return function(n){bn(a,n);function a(){var i,o,l,h;gn(this,a);for(var c=arguments.length,p=Array(c),u=0;u<c;u++)p[u]=arguments[u];return h=(o=(l=ut(this,(i=a.__proto__||Object.getPrototypeOf(a)).call.apply(i,[this].concat(p))),l),l.state={focus:!1},l.handleFocus=function(){return l.setState({focus:!0})},l.handleBlur=function(){return l.setState({focus:!1})},o),ut(l,h)}return fn(a,[{key:"render",value:function(){return s.createElement(t,{onFocus:this.handleFocus,onBlur:this.handleBlur},s.createElement(e,dn({},this.props,this.state)))}}]),a}(s.Component)},dt=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},xn=13,mn=function(e){var t=e.color,n=e.style,a=e.onClick,i=a===void 0?function(){}:a,o=e.onHover,l=e.title,h=l===void 0?t:l,c=e.children,p=e.focus,u=e.focusStyle,d=u===void 0?{}:u,f=t==="transparent",v=y({default:{swatch:dt({background:t,height:"100%",width:"100%",cursor:"pointer",position:"relative",outline:"none"},n,p?d:{})}}),b=function(T){return i(t,T)},m=function(T){return T.keyCode===xn&&i(t,T)},E=function(T){return o(t,T)},M={};return o&&(M.onMouseOver=E),s.createElement("div",dt({style:v.swatch,onClick:b,title:h,tabIndex:0,onKeyDown:m},M),c,f&&s.createElement(le,{borderRadius:v.swatch.borderRadius,boxShadow:"inset 0 0 0 1px rgba(0,0,0,0.1)"}))};const D=vn(mn);var yn=function(e){var t=e.direction,n=y({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:t==="vertical"});return s.createElement("div",{style:n.picker})},wn=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Et=function(e){var t=e.rgb,n=e.hsl,a=e.width,i=e.height,o=e.onChange,l=e.direction,h=e.style,c=e.renderers,p=e.pointer,u=e.className,d=u===void 0?"":u,f=y({default:{picker:{position:"relative",width:a,height:i},alpha:{radius:"2px",style:h}}});return s.createElement("div",{style:f.picker,className:"alpha-picker "+d},s.createElement(Pe,wn({},f.alpha,{rgb:t,hsl:n,pointer:p,renderers:c,onChange:o,direction:l})))};Et.defaultProps={width:"316px",height:"16px",direction:"horizontal",pointer:yn};O(Et);var En=function(e){var t=e.colors,n=e.onClick,a=e.onSwatchHover,i=y({default:{swatches:{marginRight:"-10px"},swatch:{width:"22px",height:"22px",float:"left",marginRight:"10px",marginBottom:"10px",borderRadius:"4px"},clear:{clear:"both"}}});return s.createElement("div",{style:i.swatches},$(t,function(o){return s.createElement(D,{key:o,color:o,style:i.swatch,onClick:n,onHover:a,focusStyle:{boxShadow:"0 0 4px "+o}})}),s.createElement("div",{style:i.clear}))},He=function(e){var t=e.onChange,n=e.onSwatchHover,a=e.hex,i=e.colors,o=e.width,l=e.triangle,h=e.styles,c=h===void 0?{}:h,p=e.className,u=p===void 0?"":p,d=a==="transparent",f=function(m,E){N(m)&&t({hex:m,source:"hex"},E)},v=y(_({default:{card:{width:o,background:"#fff",boxShadow:"0 1px rgba(0,0,0,.1)",borderRadius:"6px",position:"relative"},head:{height:"110px",background:a,borderRadius:"6px 6px 0 0",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"},body:{padding:"10px"},label:{fontSize:"18px",color:Be(a),position:"relative"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 10px 10px 10px",borderColor:"transparent transparent "+a+" transparent",position:"absolute",top:"-10px",left:"50%",marginLeft:"-10px"},input:{width:"100%",fontSize:"12px",color:"#666",border:"0px",outline:"none",height:"22px",boxShadow:"inset 0 0 0 1px #ddd",borderRadius:"4px",padding:"0 7px",boxSizing:"border-box"}},"hide-triangle":{triangle:{display:"none"}}},c),{"hide-triangle":l==="hide"});return s.createElement("div",{style:v.card,className:"block-picker "+u},s.createElement("div",{style:v.triangle}),s.createElement("div",{style:v.head},d&&s.createElement(le,{borderRadius:"6px 6px 0 0"}),s.createElement("div",{style:v.label},a)),s.createElement("div",{style:v.body},s.createElement(En,{colors:i,onClick:f,onSwatchHover:n}),s.createElement(w,{style:{input:v.input},value:a,onChange:f})))};He.propTypes={width:g.oneOfType([g.string,g.number]),colors:g.arrayOf(g.string),triangle:g.oneOf(["top","hide"]),styles:g.object};He.defaultProps={width:170,colors:["#D9E3F0","#F47373","#697689","#37D67A","#2CCCE4","#555555","#dce775","#ff8a65","#ba68c8"],triangle:"top",styles:{}};O(He);var U={100:"#ffcdd2",300:"#e57373",500:"#f44336",700:"#d32f2f",900:"#b71c1c"},I={100:"#f8bbd0",300:"#f06292",500:"#e91e63",700:"#c2185b",900:"#880e4f"},V={100:"#e1bee7",300:"#ba68c8",500:"#9c27b0",700:"#7b1fa2",900:"#4a148c"},q={100:"#d1c4e9",300:"#9575cd",500:"#673ab7",700:"#512da8",900:"#311b92"},X={100:"#c5cae9",300:"#7986cb",500:"#3f51b5",700:"#303f9f",900:"#1a237e"},Y={100:"#bbdefb",300:"#64b5f6",500:"#2196f3",700:"#1976d2",900:"#0d47a1"},K={100:"#b3e5fc",300:"#4fc3f7",500:"#03a9f4",700:"#0288d1",900:"#01579b"},Z={100:"#b2ebf2",300:"#4dd0e1",500:"#00bcd4",700:"#0097a7",900:"#006064"},J={100:"#b2dfdb",300:"#4db6ac",500:"#009688",700:"#00796b",900:"#004d40"},de={100:"#c8e6c9",300:"#81c784",500:"#4caf50",700:"#388e3c"},Q={100:"#dcedc8",300:"#aed581",500:"#8bc34a",700:"#689f38",900:"#33691e"},ee={100:"#f0f4c3",300:"#dce775",500:"#cddc39",700:"#afb42b",900:"#827717"},te={100:"#fff9c4",300:"#fff176",500:"#ffeb3b",700:"#fbc02d",900:"#f57f17"},re={100:"#ffecb3",300:"#ffd54f",500:"#ffc107",700:"#ffa000",900:"#ff6f00"},ne={100:"#ffe0b2",300:"#ffb74d",500:"#ff9800",700:"#f57c00",900:"#e65100"},ae={100:"#ffccbc",300:"#ff8a65",500:"#ff5722",700:"#e64a19",900:"#bf360c"},ie={100:"#d7ccc8",300:"#a1887f",500:"#795548",700:"#5d4037",900:"#3e2723"},oe={100:"#cfd8dc",300:"#90a4ae",500:"#607d8b",700:"#455a64",900:"#263238"},St=function(e){var t=e.color,n=e.onClick,a=e.onSwatchHover,i=e.hover,o=e.active,l=e.circleSize,h=e.circleSpacing,c=y({default:{swatch:{width:l,height:l,marginRight:h,marginBottom:h,transform:"scale(1)",transition:"100ms transform ease"},Swatch:{borderRadius:"50%",background:"transparent",boxShadow:"inset 0 0 0 "+(l/2+1)+"px "+t,transition:"100ms box-shadow ease"}},hover:{swatch:{transform:"scale(1.2)"}},active:{Swatch:{boxShadow:"inset 0 0 0 3px "+t}}},{hover:i,active:o});return s.createElement("div",{style:c.swatch},s.createElement(D,{style:c.Swatch,color:t,onClick:n,onHover:a,focusStyle:{boxShadow:c.Swatch.boxShadow+", 0 0 5px "+t}}))};St.defaultProps={circleSize:28,circleSpacing:14};const Sn=Fe.handleHover(St);var Ae=function(e){var t=e.width,n=e.onChange,a=e.onSwatchHover,i=e.colors,o=e.hex,l=e.circleSize,h=e.styles,c=h===void 0?{}:h,p=e.circleSpacing,u=e.className,d=u===void 0?"":u,f=y(_({default:{card:{width:t,display:"flex",flexWrap:"wrap",marginRight:-p,marginBottom:-p}}},c)),v=function(m,E){return n({hex:m,source:"hex"},E)};return s.createElement("div",{style:f.card,className:"circle-picker "+d},$(i,function(b){return s.createElement(Sn,{key:b,color:b,onClick:v,onSwatchHover:a,active:o===b.toLowerCase(),circleSize:l,circleSpacing:p})}))};Ae.propTypes={width:g.oneOfType([g.string,g.number]),circleSize:g.number,circleSpacing:g.number,styles:g.object};Ae.defaultProps={width:252,circleSize:28,circleSpacing:14,colors:[U[500],I[500],V[500],q[500],X[500],Y[500],K[500],Z[500],J[500],de[500],Q[500],ee[500],te[500],re[500],ne[500],ae[500],ie[500],oe[500]],styles:{}};O(Ae);var me={},ft;function Cn(){if(ft)return me;ft=1,Object.defineProperty(me,"__esModule",{value:!0});var r=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(o[c]=h[c])}return o},e=Ee(),t=n(e);function n(o){return o&&o.__esModule?o:{default:o}}function a(o,l){var h={};for(var c in o)l.indexOf(c)>=0||Object.prototype.hasOwnProperty.call(o,c)&&(h[c]=o[c]);return h}var i=24;return me.default=function(o){var l=o.fill,h=l===void 0?"currentColor":l,c=o.width,p=c===void 0?i:c,u=o.height,d=u===void 0?i:u,f=o.style,v=f===void 0?{}:f,b=a(o,["fill","width","height","style"]);return t.default.createElement("svg",r({viewBox:"0 0 "+i+" "+i,style:r({fill:h,width:p,height:d},v)},b),t.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},me}var kn=Cn();const Rn=Oe(kn);var _n=function(){function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function On(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Mn(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function Fn(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Ct=function(r){Fn(e,r);function e(t){On(this,e);var n=Mn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return n.toggleViews=function(){n.state.view==="hex"?n.setState({view:"rgb"}):n.state.view==="rgb"?n.setState({view:"hsl"}):n.state.view==="hsl"&&(n.props.hsl.a===1?n.setState({view:"hex"}):n.setState({view:"rgb"}))},n.handleChange=function(a,i){a.hex?N(a.hex)&&n.props.onChange({hex:a.hex,source:"hex"},i):a.r||a.g||a.b?n.props.onChange({r:a.r||n.props.rgb.r,g:a.g||n.props.rgb.g,b:a.b||n.props.rgb.b,source:"rgb"},i):a.a?(a.a<0?a.a=0:a.a>1&&(a.a=1),n.props.onChange({h:n.props.hsl.h,s:n.props.hsl.s,l:n.props.hsl.l,a:Math.round(a.a*100)/100,source:"rgb"},i)):(a.h||a.s||a.l)&&(typeof a.s=="string"&&a.s.includes("%")&&(a.s=a.s.replace("%","")),typeof a.l=="string"&&a.l.includes("%")&&(a.l=a.l.replace("%","")),a.s==1?a.s=.01:a.l==1&&(a.l=.01),n.props.onChange({h:a.h||n.props.hsl.h,s:Number(Xe(a.s)?n.props.hsl.s:a.s),l:Number(Xe(a.l)?n.props.hsl.l:a.l),source:"hsl"},i))},n.showHighlight=function(a){a.currentTarget.style.background="#eee"},n.hideHighlight=function(a){a.currentTarget.style.background="transparent"},t.hsl.a!==1&&t.view==="hex"?n.state={view:"rgb"}:n.state={view:t.view},n}return _n(e,[{key:"render",value:function(){var n=this,a=y({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),i=void 0;return this.state.view==="hex"?i=s.createElement("div",{style:a.fields,className:"flexbox-fix"},s.createElement("div",{style:a.field},s.createElement(w,{style:{input:a.input,label:a.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?i=s.createElement("div",{style:a.fields,className:"flexbox-fix"},s.createElement("div",{style:a.field},s.createElement(w,{style:{input:a.input,label:a.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),s.createElement("div",{style:a.field},s.createElement(w,{style:{input:a.input,label:a.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),s.createElement("div",{style:a.field},s.createElement(w,{style:{input:a.input,label:a.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),s.createElement("div",{style:a.alpha},s.createElement(w,{style:{input:a.input,label:a.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(i=s.createElement("div",{style:a.fields,className:"flexbox-fix"},s.createElement("div",{style:a.field},s.createElement(w,{style:{input:a.input,label:a.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),s.createElement("div",{style:a.field},s.createElement(w,{style:{input:a.input,label:a.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),s.createElement("div",{style:a.field},s.createElement(w,{style:{input:a.input,label:a.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),s.createElement("div",{style:a.alpha},s.createElement(w,{style:{input:a.input,label:a.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),s.createElement("div",{style:a.wrap,className:"flexbox-fix"},i,s.createElement("div",{style:a.toggle},s.createElement("div",{style:a.icon,onClick:this.toggleViews,ref:function(l){return n.icon=l}},s.createElement(Rn,{style:a.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(n,a){return n.hsl.a!==1&&a.view==="hex"?{view:"rgb"}:null}}]),e}(s.Component);Ct.defaultProps={view:"hex"};var gt=function(){var e=y({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return s.createElement("div",{style:e.picker})},Pn=function(){var e=y({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return s.createElement("div",{style:e.picker})},Te=function(e){var t=e.width,n=e.onChange,a=e.disableAlpha,i=e.rgb,o=e.hsl,l=e.hsv,h=e.hex,c=e.renderers,p=e.styles,u=p===void 0?{}:p,d=e.className,f=d===void 0?"":d,v=e.defaultView,b=y(_({default:{picker:{width:t,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+i.r+", "+i.g+", "+i.b+", "+i.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},u),{disableAlpha:a});return s.createElement("div",{style:b.picker,className:"chrome-picker "+f},s.createElement("div",{style:b.saturation},s.createElement(ve,{style:b.Saturation,hsl:o,hsv:l,pointer:Pn,onChange:n})),s.createElement("div",{style:b.body},s.createElement("div",{style:b.controls,className:"flexbox-fix"},s.createElement("div",{style:b.color},s.createElement("div",{style:b.swatch},s.createElement("div",{style:b.active}),s.createElement(le,{renderers:c}))),s.createElement("div",{style:b.toggles},s.createElement("div",{style:b.hue},s.createElement(se,{style:b.Hue,hsl:o,pointer:gt,onChange:n})),s.createElement("div",{style:b.alpha},s.createElement(Pe,{style:b.Alpha,rgb:i,hsl:o,pointer:gt,renderers:c,onChange:n})))),s.createElement(Ct,{rgb:i,hsl:o,hex:h,view:v,onChange:n,disableAlpha:a})))};Te.propTypes={width:g.oneOfType([g.string,g.number]),disableAlpha:g.bool,styles:g.object,defaultView:g.oneOf(["hex","rgb","hsl"])};Te.defaultProps={width:225,disableAlpha:!1,styles:{}};const Bn=O(Te);var Hn=function(e){var t=e.color,n=e.onClick,a=n===void 0?function(){}:n,i=e.onSwatchHover,o=e.active,l=y({default:{color:{background:t,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:Be(t),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:o,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return s.createElement(D,{style:l.color,color:t,onClick:a,onHover:i,focusStyle:{boxShadow:"0 0 4px "+t}},s.createElement("div",{style:l.dot}))},An=function(e){var t=e.hex,n=e.rgb,a=e.onChange,i=y({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:t},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),o=function(h,c){h.r||h.g||h.b?a({r:h.r||n.r,g:h.g||n.g,b:h.b||n.b,source:"rgb"},c):a({hex:h.hex,source:"hex"},c)};return s.createElement("div",{style:i.fields,className:"flexbox-fix"},s.createElement("div",{style:i.active}),s.createElement(w,{style:{wrap:i.HEXwrap,input:i.HEXinput,label:i.HEXlabel},label:"hex",value:t,onChange:o}),s.createElement(w,{style:{wrap:i.RGBwrap,input:i.RGBinput,label:i.RGBlabel},label:"r",value:n.r,onChange:o}),s.createElement(w,{style:{wrap:i.RGBwrap,input:i.RGBinput,label:i.RGBlabel},label:"g",value:n.g,onChange:o}),s.createElement(w,{style:{wrap:i.RGBwrap,input:i.RGBinput,label:i.RGBlabel},label:"b",value:n.b,onChange:o}))},$e=function(e){var t=e.onChange,n=e.onSwatchHover,a=e.colors,i=e.hex,o=e.rgb,l=e.styles,h=l===void 0?{}:l,c=e.className,p=c===void 0?"":c,u=y(_({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},h)),d=function(v,b){v.hex?N(v.hex)&&t({hex:v.hex,source:"hex"},b):t(v,b)};return s.createElement(be,{style:u.Compact,styles:h},s.createElement("div",{style:u.compact,className:"compact-picker "+p},s.createElement("div",null,$(a,function(f){return s.createElement(Hn,{key:f,color:f,active:f.toLowerCase()===i,onClick:d,onSwatchHover:n})}),s.createElement("div",{style:u.clear})),s.createElement(An,{hex:i,rgb:o,onChange:d})))};$e.propTypes={colors:g.arrayOf(g.string),styles:g.object};$e.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};O($e);var Tn=function(e){var t=e.hover,n=e.color,a=e.onClick,i=e.onSwatchHover,o={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},l=y({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:o}},{hover:t});return s.createElement("div",{style:l.swatch},s.createElement(D,{color:n,onClick:a,onHover:i,focusStyle:o}))};const $n=Fe.handleHover(Tn);var Ne=function(e){var t=e.width,n=e.colors,a=e.onChange,i=e.onSwatchHover,o=e.triangle,l=e.styles,h=l===void 0?{}:l,c=e.className,p=c===void 0?"":c,u=y(_({default:{card:{width:t,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},h),{"hide-triangle":o==="hide","top-left-triangle":o==="top-left","top-right-triangle":o==="top-right","bottom-left-triangle":o==="bottom-left","bottom-right-triangle":o==="bottom-right"}),d=function(v,b){return a({hex:v,source:"hex"},b)};return s.createElement("div",{style:u.card,className:"github-picker "+p},s.createElement("div",{style:u.triangleShadow}),s.createElement("div",{style:u.triangle}),$(n,function(f){return s.createElement($n,{color:f,key:f,onClick:d,onSwatchHover:i})}))};Ne.propTypes={width:g.oneOfType([g.string,g.number]),colors:g.arrayOf(g.string),triangle:g.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:g.object};Ne.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};O(Ne);var Nn=function(e){var t=e.direction,n=y({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:t==="vertical"});return s.createElement("div",{style:n.picker})},Dn=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},De=function(e){var t=e.width,n=e.height,a=e.onChange,i=e.hsl,o=e.direction,l=e.pointer,h=e.styles,c=h===void 0?{}:h,p=e.className,u=p===void 0?"":p,d=y(_({default:{picker:{position:"relative",width:t,height:n},hue:{radius:"2px"}}},c)),f=function(b){return a({a:1,h:b.h,l:.5,s:1})};return s.createElement("div",{style:d.picker,className:"hue-picker "+u},s.createElement(se,Dn({},d.hue,{hsl:i,pointer:l,onChange:f,direction:o})))};De.propTypes={styles:g.object};De.defaultProps={width:"316px",height:"16px",direction:"horizontal",pointer:Nn,styles:{}};O(De);var jn=function(e){var t=e.onChange,n=e.hex,a=e.rgb,i=e.styles,o=i===void 0?{}:i,l=e.className,h=l===void 0?"":l,c=y(_({default:{material:{width:"98px",height:"98px",padding:"16px",fontFamily:"Roboto"},HEXwrap:{position:"relative"},HEXinput:{width:"100%",marginTop:"12px",fontSize:"15px",color:"#333",padding:"0px",border:"0px",borderBottom:"2px solid "+n,outline:"none",height:"30px"},HEXlabel:{position:"absolute",top:"0px",left:"0px",fontSize:"11px",color:"#999999",textTransform:"capitalize"},Hex:{style:{}},RGBwrap:{position:"relative"},RGBinput:{width:"100%",marginTop:"12px",fontSize:"15px",color:"#333",padding:"0px",border:"0px",borderBottom:"1px solid #eee",outline:"none",height:"30px"},RGBlabel:{position:"absolute",top:"0px",left:"0px",fontSize:"11px",color:"#999999",textTransform:"capitalize"},split:{display:"flex",marginRight:"-10px",paddingTop:"11px"},third:{flex:"1",paddingRight:"10px"}}},o)),p=function(d,f){d.hex?N(d.hex)&&t({hex:d.hex,source:"hex"},f):(d.r||d.g||d.b)&&t({r:d.r||a.r,g:d.g||a.g,b:d.b||a.b,source:"rgb"},f)};return s.createElement(be,{styles:o},s.createElement("div",{style:c.material,className:"material-picker "+h},s.createElement(w,{style:{wrap:c.HEXwrap,input:c.HEXinput,label:c.HEXlabel},label:"hex",value:n,onChange:p}),s.createElement("div",{style:c.split,className:"flexbox-fix"},s.createElement("div",{style:c.third},s.createElement(w,{style:{wrap:c.RGBwrap,input:c.RGBinput,label:c.RGBlabel},label:"r",value:a.r,onChange:p})),s.createElement("div",{style:c.third},s.createElement(w,{style:{wrap:c.RGBwrap,input:c.RGBinput,label:c.RGBlabel},label:"g",value:a.g,onChange:p})),s.createElement("div",{style:c.third},s.createElement(w,{style:{wrap:c.RGBwrap,input:c.RGBinput,label:c.RGBlabel},label:"b",value:a.b,onChange:p})))))};O(jn);var Ln=function(e){var t=e.onChange,n=e.rgb,a=e.hsv,i=e.hex,o=y({default:{fields:{paddingTop:"5px",paddingBottom:"9px",width:"80px",position:"relative"},divider:{height:"5px"},RGBwrap:{position:"relative"},RGBinput:{marginLeft:"40%",width:"40%",height:"18px",border:"1px solid #888888",boxShadow:"inset 0 1px 1px rgba(0,0,0,.1), 0 1px 0 0 #ECECEC",marginBottom:"5px",fontSize:"13px",paddingLeft:"3px",marginRight:"10px"},RGBlabel:{left:"0px",top:"0px",width:"34px",textTransform:"uppercase",fontSize:"13px",height:"18px",lineHeight:"22px",position:"absolute"},HEXwrap:{position:"relative"},HEXinput:{marginLeft:"20%",width:"80%",height:"18px",border:"1px solid #888888",boxShadow:"inset 0 1px 1px rgba(0,0,0,.1), 0 1px 0 0 #ECECEC",marginBottom:"6px",fontSize:"13px",paddingLeft:"3px"},HEXlabel:{position:"absolute",top:"0px",left:"0px",width:"14px",textTransform:"uppercase",fontSize:"13px",height:"18px",lineHeight:"22px"},fieldSymbols:{position:"absolute",top:"5px",right:"-7px",fontSize:"13px"},symbol:{height:"20px",lineHeight:"22px",paddingBottom:"7px"}}}),l=function(c,p){c["#"]?N(c["#"])&&t({hex:c["#"],source:"hex"},p):c.r||c.g||c.b?t({r:c.r||n.r,g:c.g||n.g,b:c.b||n.b,source:"rgb"},p):(c.h||c.s||c.v)&&t({h:c.h||a.h,s:c.s||a.s,v:c.v||a.v,source:"hsv"},p)};return s.createElement("div",{style:o.fields},s.createElement(w,{style:{wrap:o.RGBwrap,input:o.RGBinput,label:o.RGBlabel},label:"h",value:Math.round(a.h),onChange:l}),s.createElement(w,{style:{wrap:o.RGBwrap,input:o.RGBinput,label:o.RGBlabel},label:"s",value:Math.round(a.s*100),onChange:l}),s.createElement(w,{style:{wrap:o.RGBwrap,input:o.RGBinput,label:o.RGBlabel},label:"v",value:Math.round(a.v*100),onChange:l}),s.createElement("div",{style:o.divider}),s.createElement(w,{style:{wrap:o.RGBwrap,input:o.RGBinput,label:o.RGBlabel},label:"r",value:n.r,onChange:l}),s.createElement(w,{style:{wrap:o.RGBwrap,input:o.RGBinput,label:o.RGBlabel},label:"g",value:n.g,onChange:l}),s.createElement(w,{style:{wrap:o.RGBwrap,input:o.RGBinput,label:o.RGBlabel},label:"b",value:n.b,onChange:l}),s.createElement("div",{style:o.divider}),s.createElement(w,{style:{wrap:o.HEXwrap,input:o.HEXinput,label:o.HEXlabel},label:"#",value:i.replace("#",""),onChange:l}),s.createElement("div",{style:o.fieldSymbols},s.createElement("div",{style:o.symbol},"°"),s.createElement("div",{style:o.symbol},"%"),s.createElement("div",{style:o.symbol},"%")))},zn=function(e){var t=e.hsl,n=y({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}},"black-outline":{picker:{boxShadow:"inset 0 0 0 1px #000"}}},{"black-outline":t.l>.5});return s.createElement("div",{style:n.picker})},Gn=function(){var e=y({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return s.createElement("div",{style:e.pointer},s.createElement("div",{style:e.left},s.createElement("div",{style:e.leftInside})),s.createElement("div",{style:e.right},s.createElement("div",{style:e.rightInside})))},bt=function(e){var t=e.onClick,n=e.label,a=e.children,i=e.active,o=y({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:i});return s.createElement("div",{style:o.button,onClick:t},n||a)},Wn=function(e){var t=e.rgb,n=e.currentColor,a=y({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+t.r+","+t.g+", "+t.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:n,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return s.createElement("div",null,s.createElement("div",{style:a.label},"new"),s.createElement("div",{style:a.swatches},s.createElement("div",{style:a.new}),s.createElement("div",{style:a.current})),s.createElement("div",{style:a.label},"current"))},Un=function(){function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function In(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Vn(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function qn(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var je=function(r){qn(e,r);function e(t){In(this,e);var n=Vn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return n.state={currentColor:t.hex},n}return Un(e,[{key:"render",value:function(){var n=this.props,a=n.styles,i=a===void 0?{}:a,o=n.className,l=o===void 0?"":o,h=y(_({default:{picker:{background:"#DCDCDC",borderRadius:"4px",boxShadow:"0 0 0 1px rgba(0,0,0,.25), 0 8px 16px rgba(0,0,0,.15)",boxSizing:"initial",width:"513px"},head:{backgroundImage:"linear-gradient(-180deg, #F0F0F0 0%, #D4D4D4 100%)",borderBottom:"1px solid #B1B1B1",boxShadow:"inset 0 1px 0 0 rgba(255,255,255,.2), inset 0 -1px 0 0 rgba(0,0,0,.02)",height:"23px",lineHeight:"24px",borderRadius:"4px 4px 0 0",fontSize:"13px",color:"#4D4D4D",textAlign:"center"},body:{padding:"15px 15px 0",display:"flex"},saturation:{width:"256px",height:"256px",position:"relative",border:"2px solid #B3B3B3",borderBottom:"2px solid #F0F0F0",overflow:"hidden"},hue:{position:"relative",height:"256px",width:"19px",marginLeft:"10px",border:"2px solid #B3B3B3",borderBottom:"2px solid #F0F0F0"},controls:{width:"180px",marginLeft:"10px"},top:{display:"flex"},previews:{width:"60px"},actions:{flex:"1",marginLeft:"20px"}}},i));return s.createElement("div",{style:h.picker,className:"photoshop-picker "+l},s.createElement("div",{style:h.head},this.props.header),s.createElement("div",{style:h.body,className:"flexbox-fix"},s.createElement("div",{style:h.saturation},s.createElement(ve,{hsl:this.props.hsl,hsv:this.props.hsv,pointer:zn,onChange:this.props.onChange})),s.createElement("div",{style:h.hue},s.createElement(se,{direction:"vertical",hsl:this.props.hsl,pointer:Gn,onChange:this.props.onChange})),s.createElement("div",{style:h.controls},s.createElement("div",{style:h.top,className:"flexbox-fix"},s.createElement("div",{style:h.previews},s.createElement(Wn,{rgb:this.props.rgb,currentColor:this.state.currentColor})),s.createElement("div",{style:h.actions},s.createElement(bt,{label:"OK",onClick:this.props.onAccept,active:!0}),s.createElement(bt,{label:"Cancel",onClick:this.props.onCancel}),s.createElement(Ln,{onChange:this.props.onChange,rgb:this.props.rgb,hsv:this.props.hsv,hex:this.props.hex}))))))}}]),e}(s.Component);je.propTypes={header:g.string,styles:g.object};je.defaultProps={header:"Color Picker",styles:{}};O(je);var Xn=function(e){var t=e.onChange,n=e.rgb,a=e.hsl,i=e.hex,o=e.disableAlpha,l=y({default:{fields:{display:"flex",paddingTop:"4px"},single:{flex:"1",paddingLeft:"6px"},alpha:{flex:"1",paddingLeft:"6px"},double:{flex:"2"},input:{width:"80%",padding:"4px 10% 3px",border:"none",boxShadow:"inset 0 0 0 1px #ccc",fontSize:"11px"},label:{display:"block",textAlign:"center",fontSize:"11px",color:"#222",paddingTop:"3px",paddingBottom:"4px",textTransform:"capitalize"}},disableAlpha:{alpha:{display:"none"}}},{disableAlpha:o}),h=function(p,u){p.hex?N(p.hex)&&t({hex:p.hex,source:"hex"},u):p.r||p.g||p.b?t({r:p.r||n.r,g:p.g||n.g,b:p.b||n.b,a:n.a,source:"rgb"},u):p.a&&(p.a<0?p.a=0:p.a>100&&(p.a=100),p.a/=100,t({h:a.h,s:a.s,l:a.l,a:p.a,source:"rgb"},u))};return s.createElement("div",{style:l.fields,className:"flexbox-fix"},s.createElement("div",{style:l.double},s.createElement(w,{style:{input:l.input,label:l.label},label:"hex",value:i.replace("#",""),onChange:h})),s.createElement("div",{style:l.single},s.createElement(w,{style:{input:l.input,label:l.label},label:"r",value:n.r,onChange:h,dragLabel:"true",dragMax:"255"})),s.createElement("div",{style:l.single},s.createElement(w,{style:{input:l.input,label:l.label},label:"g",value:n.g,onChange:h,dragLabel:"true",dragMax:"255"})),s.createElement("div",{style:l.single},s.createElement(w,{style:{input:l.input,label:l.label},label:"b",value:n.b,onChange:h,dragLabel:"true",dragMax:"255"})),s.createElement("div",{style:l.alpha},s.createElement(w,{style:{input:l.input,label:l.label},label:"a",value:Math.round(n.a*100),onChange:h,dragLabel:"true",dragMax:"100"})))},Yn=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},kt=function(e){var t=e.colors,n=e.onClick,a=n===void 0?function(){}:n,i=e.onSwatchHover,o=y({default:{colors:{margin:"0 -10px",padding:"10px 0 0 10px",borderTop:"1px solid #eee",display:"flex",flexWrap:"wrap",position:"relative"},swatchWrap:{width:"16px",height:"16px",margin:"0 10px 10px 0"},swatch:{borderRadius:"3px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.15)"}},"no-presets":{colors:{display:"none"}}},{"no-presets":!t||!t.length}),l=function(c,p){a({hex:c,source:"hex"},p)};return s.createElement("div",{style:o.colors,className:"flexbox-fix"},t.map(function(h){var c=typeof h=="string"?{color:h}:h,p=""+c.color+(c.title||"");return s.createElement("div",{key:p,style:o.swatchWrap},s.createElement(D,Yn({},c,{style:o.swatch,onClick:l,onHover:i,focusStyle:{boxShadow:"inset 0 0 0 1px rgba(0,0,0,.15), 0 0 4px "+c.color}})))}))};kt.propTypes={colors:g.arrayOf(g.oneOfType([g.string,g.shape({color:g.string,title:g.string})])).isRequired};var Kn=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Le=function(e){var t=e.width,n=e.rgb,a=e.hex,i=e.hsv,o=e.hsl,l=e.onChange,h=e.onSwatchHover,c=e.disableAlpha,p=e.presetColors,u=e.renderers,d=e.styles,f=d===void 0?{}:d,v=e.className,b=v===void 0?"":v,m=y(_({default:Kn({picker:{width:t,padding:"10px 10px 0",boxSizing:"initial",background:"#fff",borderRadius:"4px",boxShadow:"0 0 0 1px rgba(0,0,0,.15), 0 8px 16px rgba(0,0,0,.15)"},saturation:{width:"100%",paddingBottom:"75%",position:"relative",overflow:"hidden"},Saturation:{radius:"3px",shadow:"inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"},controls:{display:"flex"},sliders:{padding:"4px 0",flex:"1"},color:{width:"24px",height:"24px",position:"relative",marginTop:"4px",marginLeft:"4px",borderRadius:"3px"},activeColor:{absolute:"0px 0px 0px 0px",borderRadius:"2px",background:"rgba("+n.r+","+n.g+","+n.b+","+n.a+")",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"},hue:{position:"relative",height:"10px",overflow:"hidden"},Hue:{radius:"2px",shadow:"inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"},alpha:{position:"relative",height:"10px",marginTop:"4px",overflow:"hidden"},Alpha:{radius:"2px",shadow:"inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"}},f),disableAlpha:{color:{height:"10px"},hue:{height:"10px"},alpha:{display:"none"}}},f),{disableAlpha:c});return s.createElement("div",{style:m.picker,className:"sketch-picker "+b},s.createElement("div",{style:m.saturation},s.createElement(ve,{style:m.Saturation,hsl:o,hsv:i,onChange:l})),s.createElement("div",{style:m.controls,className:"flexbox-fix"},s.createElement("div",{style:m.sliders},s.createElement("div",{style:m.hue},s.createElement(se,{style:m.Hue,hsl:o,onChange:l})),s.createElement("div",{style:m.alpha},s.createElement(Pe,{style:m.Alpha,rgb:n,hsl:o,renderers:u,onChange:l}))),s.createElement("div",{style:m.color},s.createElement(le,null),s.createElement("div",{style:m.activeColor}))),s.createElement(Xn,{rgb:n,hsl:o,hex:a,onChange:l,disableAlpha:c}),s.createElement(kt,{colors:p,onClick:l,onSwatchHover:h}))};Le.propTypes={disableAlpha:g.bool,width:g.oneOfType([g.string,g.number]),styles:g.object};Le.defaultProps={disableAlpha:!1,width:200,styles:{},presetColors:["#D0021B","#F5A623","#F8E71C","#8B572A","#7ED321","#417505","#BD10E0","#9013FE","#4A90E2","#50E3C2","#B8E986","#000000","#4A4A4A","#9B9B9B","#FFFFFF"]};O(Le);var ce=function(e){var t=e.hsl,n=e.offset,a=e.onClick,i=a===void 0?function(){}:a,o=e.active,l=e.first,h=e.last,c=y({default:{swatch:{height:"12px",background:"hsl("+t.h+", 50%, "+n*100+"%)",cursor:"pointer"}},first:{swatch:{borderRadius:"2px 0 0 2px"}},last:{swatch:{borderRadius:"0 2px 2px 0"}},active:{swatch:{transform:"scaleY(1.8)",borderRadius:"3.6px/2px"}}},{active:o,first:l,last:h}),p=function(d){return i({h:t.h,s:.5,l:n,source:"hsl"},d)};return s.createElement("div",{style:c.swatch,onClick:p})},Zn=function(e){var t=e.onClick,n=e.hsl,a=y({default:{swatches:{marginTop:"20px"},swatch:{boxSizing:"border-box",width:"20%",paddingRight:"1px",float:"left"},clear:{clear:"both"}}}),i=.1;return s.createElement("div",{style:a.swatches},s.createElement("div",{style:a.swatch},s.createElement(ce,{hsl:n,offset:".80",active:Math.abs(n.l-.8)<i&&Math.abs(n.s-.5)<i,onClick:t,first:!0})),s.createElement("div",{style:a.swatch},s.createElement(ce,{hsl:n,offset:".65",active:Math.abs(n.l-.65)<i&&Math.abs(n.s-.5)<i,onClick:t})),s.createElement("div",{style:a.swatch},s.createElement(ce,{hsl:n,offset:".50",active:Math.abs(n.l-.5)<i&&Math.abs(n.s-.5)<i,onClick:t})),s.createElement("div",{style:a.swatch},s.createElement(ce,{hsl:n,offset:".35",active:Math.abs(n.l-.35)<i&&Math.abs(n.s-.5)<i,onClick:t})),s.createElement("div",{style:a.swatch},s.createElement(ce,{hsl:n,offset:".20",active:Math.abs(n.l-.2)<i&&Math.abs(n.s-.5)<i,onClick:t,last:!0})),s.createElement("div",{style:a.clear}))},Jn=function(){var e=y({default:{picker:{width:"14px",height:"14px",borderRadius:"6px",transform:"translate(-7px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return s.createElement("div",{style:e.picker})},ze=function(e){var t=e.hsl,n=e.onChange,a=e.pointer,i=e.styles,o=i===void 0?{}:i,l=e.className,h=l===void 0?"":l,c=y(_({default:{hue:{height:"12px",position:"relative"},Hue:{radius:"2px"}}},o));return s.createElement("div",{style:c.wrap||{},className:"slider-picker "+h},s.createElement("div",{style:c.hue},s.createElement(se,{style:c.Hue,hsl:t,pointer:a,onChange:n})),s.createElement("div",{style:c.swatches},s.createElement(Zn,{hsl:t,onClick:n})))};ze.propTypes={styles:g.object};ze.defaultProps={pointer:Jn,styles:{}};O(ze);var ye={},vt;function Qn(){if(vt)return ye;vt=1,Object.defineProperty(ye,"__esModule",{value:!0});var r=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(o[c]=h[c])}return o},e=Ee(),t=n(e);function n(o){return o&&o.__esModule?o:{default:o}}function a(o,l){var h={};for(var c in o)l.indexOf(c)>=0||Object.prototype.hasOwnProperty.call(o,c)&&(h[c]=o[c]);return h}var i=24;return ye.default=function(o){var l=o.fill,h=l===void 0?"currentColor":l,c=o.width,p=c===void 0?i:c,u=o.height,d=u===void 0?i:u,f=o.style,v=f===void 0?{}:f,b=a(o,["fill","width","height","style"]);return t.default.createElement("svg",r({viewBox:"0 0 "+i+" "+i,style:r({fill:h,width:p,height:d},v)},b),t.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},ye}var ea=Qn();const ta=Oe(ea);var ra=function(e){var t=e.color,n=e.onClick,a=n===void 0?function(){}:n,i=e.onSwatchHover,o=e.first,l=e.last,h=e.active,c=y({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:t,marginBottom:"1px"},check:{color:Be(t),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:o,last:l,active:h,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return s.createElement(D,{color:t,style:c.color,onClick:a,onHover:i,focusStyle:{boxShadow:"0 0 4px "+t}},s.createElement("div",{style:c.check},s.createElement(ta,null)))},na=function(e){var t=e.onClick,n=e.onSwatchHover,a=e.group,i=e.active,o=y({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return s.createElement("div",{style:o.group},$(a,function(l,h){return s.createElement(ra,{key:l,color:l,active:l.toLowerCase()===i,first:h===0,last:h===a.length-1,onClick:t,onSwatchHover:n})}))},Ge=function(e){var t=e.width,n=e.height,a=e.onChange,i=e.onSwatchHover,o=e.colors,l=e.hex,h=e.styles,c=h===void 0?{}:h,p=e.className,u=p===void 0?"":p,d=y(_({default:{picker:{width:t,height:n},overflow:{height:n,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},c)),f=function(b,m){return a({hex:b,source:"hex"},m)};return s.createElement("div",{style:d.picker,className:"swatches-picker "+u},s.createElement(be,null,s.createElement("div",{style:d.overflow},s.createElement("div",{style:d.body},$(o,function(v){return s.createElement(na,{key:v.toString(),group:v,active:l,onClick:f,onSwatchHover:i})}),s.createElement("div",{style:d.clear})))))};Ge.propTypes={width:g.oneOfType([g.string,g.number]),height:g.oneOfType([g.string,g.number]),colors:g.arrayOf(g.arrayOf(g.string)),styles:g.object};Ge.defaultProps={width:320,height:240,colors:[[U[900],U[700],U[500],U[300],U[100]],[I[900],I[700],I[500],I[300],I[100]],[V[900],V[700],V[500],V[300],V[100]],[q[900],q[700],q[500],q[300],q[100]],[X[900],X[700],X[500],X[300],X[100]],[Y[900],Y[700],Y[500],Y[300],Y[100]],[K[900],K[700],K[500],K[300],K[100]],[Z[900],Z[700],Z[500],Z[300],Z[100]],[J[900],J[700],J[500],J[300],J[100]],["#194D33",de[700],de[500],de[300],de[100]],[Q[900],Q[700],Q[500],Q[300],Q[100]],[ee[900],ee[700],ee[500],ee[300],ee[100]],[te[900],te[700],te[500],te[300],te[100]],[re[900],re[700],re[500],re[300],re[100]],[ne[900],ne[700],ne[500],ne[300],ne[100]],[ae[900],ae[700],ae[500],ae[300],ae[100]],[ie[900],ie[700],ie[500],ie[300],ie[100]],[oe[900],oe[700],oe[500],oe[300],oe[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};O(Ge);var We=function(e){var t=e.onChange,n=e.onSwatchHover,a=e.hex,i=e.colors,o=e.width,l=e.triangle,h=e.styles,c=h===void 0?{}:h,p=e.className,u=p===void 0?"":p,d=y(_({default:{card:{width:o,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},c),{"hide-triangle":l==="hide","top-left-triangle":l==="top-left","top-right-triangle":l==="top-right"}),f=function(b,m){N(b)&&t({hex:b,source:"hex"},m)};return s.createElement("div",{style:d.card,className:"twitter-picker "+u},s.createElement("div",{style:d.triangleShadow}),s.createElement("div",{style:d.triangle}),s.createElement("div",{style:d.body},$(i,function(v,b){return s.createElement(D,{key:b,color:v,hex:v,style:d.swatch,onClick:f,onHover:n,focusStyle:{boxShadow:"0 0 4px "+v}})}),s.createElement("div",{style:d.hash},"#"),s.createElement(w,{label:null,style:{input:d.input},value:a.replace("#",""),onChange:f}),s.createElement("div",{style:d.clear})))};We.propTypes={width:g.oneOfType([g.string,g.number]),triangle:g.oneOf(["hide","top-left","top-right"]),colors:g.arrayOf(g.string),styles:g.object};We.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};O(We);var Ue=function(e){var t=y({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(e.hsl.h)+", "+Math.round(e.hsl.s*100)+"%, "+Math.round(e.hsl.l*100)+"%)"}}});return s.createElement("div",{style:t.picker})};Ue.propTypes={hsl:g.shape({h:g.number,s:g.number,l:g.number,a:g.number})};Ue.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var Ie=function(e){var t=y({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(e.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return s.createElement("div",{style:t.picker})};Ie.propTypes={hsl:g.shape({h:g.number,s:g.number,l:g.number,a:g.number})};Ie.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var aa=function(e){var t=e.onChange,n=e.rgb,a=e.hsl,i=e.hex,o=e.hsv,l=function(f,v){if(f.hex)N(f.hex)&&t({hex:f.hex,source:"hex"},v);else if(f.rgb){var b=f.rgb.split(",");ke(f.rgb,"rgb")&&t({r:b[0],g:b[1],b:b[2],a:1,source:"rgb"},v)}else if(f.hsv){var m=f.hsv.split(",");ke(f.hsv,"hsv")&&(m[2]=m[2].replace("%",""),m[1]=m[1].replace("%",""),m[0]=m[0].replace("°",""),m[1]==1?m[1]=.01:m[2]==1&&(m[2]=.01),t({h:Number(m[0]),s:Number(m[1]),v:Number(m[2]),source:"hsv"},v))}else if(f.hsl){var E=f.hsl.split(",");ke(f.hsl,"hsl")&&(E[2]=E[2].replace("%",""),E[1]=E[1].replace("%",""),E[0]=E[0].replace("°",""),u[1]==1?u[1]=.01:u[2]==1&&(u[2]=.01),t({h:Number(E[0]),s:Number(E[1]),v:Number(E[2]),source:"hsl"},v))}},h=y({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),c=n.r+", "+n.g+", "+n.b,p=Math.round(a.h)+"°, "+Math.round(a.s*100)+"%, "+Math.round(a.l*100)+"%",u=Math.round(o.h)+"°, "+Math.round(o.s*100)+"%, "+Math.round(o.v*100)+"%";return s.createElement("div",{style:h.wrap,className:"flexbox-fix"},s.createElement("div",{style:h.fields},s.createElement("div",{style:h.double},s.createElement(w,{style:{input:h.input,label:h.label},label:"hex",value:i,onChange:l})),s.createElement("div",{style:h.column},s.createElement("div",{style:h.single},s.createElement(w,{style:{input:h.input2,label:h.label2},label:"rgb",value:c,onChange:l})),s.createElement("div",{style:h.single},s.createElement(w,{style:{input:h.input2,label:h.label2},label:"hsv",value:u,onChange:l})),s.createElement("div",{style:h.single},s.createElement(w,{style:{input:h.input2,label:h.label2},label:"hsl",value:p,onChange:l})))))},Ve=function(e){var t=e.width,n=e.onChange,a=e.rgb,i=e.hsl,o=e.hsv,l=e.hex,h=e.header,c=e.styles,p=c===void 0?{}:c,u=e.className,d=u===void 0?"":u,f=y(_({default:{picker:{width:t,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+a.r+", "+a.g+", "+a.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},p));return s.createElement("div",{style:f.picker,className:"google-picker "+d},s.createElement("div",{style:f.head},h),s.createElement("div",{style:f.swatch}),s.createElement("div",{style:f.saturation},s.createElement(ve,{hsl:i,hsv:o,pointer:Ue,onChange:n})),s.createElement("div",{style:f.body},s.createElement("div",{style:f.controls,className:"flexbox-fix"},s.createElement("div",{style:f.hue},s.createElement(se,{style:f.Hue,hsl:i,radius:"4px",pointer:Ie,onChange:n}))),s.createElement(aa,{rgb:a,hsl:i,hex:l,hsv:o,onChange:n})))};Ve.propTypes={width:g.oneOfType([g.string,g.number]),styles:g.object,header:g.string};Ve.defaultProps={width:652,styles:{},header:"Color picker"};O(Ve);const ia=ge("div",{target:"eyjgl9x0"})(({disabled:r,theme:e})=>({fontFamily:e.genericFonts.bodyFont,display:"flex",flexDirection:"column",alignItems:"flex-start",cursor:r?"not-allowed":"default",minWidth:e.sizes.minElementHeight})),oa=ge("div",{target:"eyjgl9x1"})(({theme:r})=>({div:{fontFamily:`${r.genericFonts.bodyFont} !important`},label:{fontSize:`${r.fontSizes.sm} !important`,color:`${r.colors.bodyText} !important`},input:{fontSize:`${r.fontSizes.md} !important`,height:`${r.sizes.minElementHeight} !important`,backgroundColor:`${r.colors.secondaryBg} !important`,color:`${r.colors.bodyText} !important`,borderRadius:`${r.radii.default} !important`,boxShadow:"none !important","&:focus-visible":{outline:`${r.sizes.borderWidth} solid ${r.colors.primary} !important`}},svg:{fill:`${r.colors.bodyText} !important`}})),la=ge("div",{target:"eyjgl9x2"})(({disabled:r,theme:e})=>({height:e.sizes.minElementHeight,borderRadius:e.radii.default,borderColor:e.colors.borderColor,cursor:r?"not-allowed":"pointer",pointerEvents:r?"none":"auto",boxShadow:"none",lineHeight:e.lineHeights.base,gap:e.spacing.md,"&:focus":{outline:"none"},display:"flex"})),sa=ge("div",{target:"eyjgl9x3"})(({backgroundColor:r,disabled:e,theme:t})=>({width:t.sizes.minElementHeight,height:t.sizes.minElementHeight,borderRadius:t.radii.default,borderColor:t.colors.borderColor,borderWidth:t.sizes.borderWidth,opacity:e?"0.4":"",backgroundColor:r,borderStyle:"solid",cursor:"pointer",lineHeight:t.lineHeights.base,"&:focus":{outline:"none"}})),ha=ge("div",{target:"eyjgl9x4"})({display:"flex",alignItems:"center"});ve.prototype.getContainerRenderWindow=function(){const r=this.container;let e=window,t=window;try{for(;!e.document.contains(r)&&e.parent!==e;)t=e,e=e.parent}catch{e=t}return e};const ca=r=>{const{disabled:e,value:t,showValue:n,label:a,labelVisibility:i,onChange:o,help:l}=r,[h,c]=C.useState(t),p=Nt();C.useEffect(()=>{c(t)},[t]);const u=C.useCallback(v=>{c(v.hex)},[]),d=C.useCallback(()=>{o(h)},[o,h]),f={default:{picker:{borderRadius:p.radii.default,boxShadow:"none",backgroundColor:p.colors.bgColor},saturation:{borderRadius:`${p.radii.default} ${p.radii.default} 0 0`,userSelect:"none"},body:{padding:p.spacing.xl}}};return qe(ia,{className:"stColorPicker","data-testid":"stColorPicker",disabled:e,children:[A(zt,{label:a,disabled:e,labelVisibility:i,children:l&&A(Dt,{children:A(jt,{content:l,placement:Lt.TOP_RIGHT})})}),A(Gt,{onClose:d,placement:"bottomLeft",content:()=>A(oa,{"data-testid":"stColorPickerPopover",children:A(Bn,{color:h,onChange:u,disableAlpha:!0,styles:f})}),children:qe(la,{disabled:e,children:[A(sa,{"data-testid":"stColorPickerBlock",backgroundColor:h,disabled:e}),n&&A(ha,{children:h.toUpperCase()})]})})]})},pa=C.memo(ca),ua=(r,e)=>r.getStringValue(e),da=r=>r.default??null,fa=r=>r.value??null,ga=(r,e,t,n)=>{e.setStringValue(r,t.value,{fromUi:t.fromUi},n)},ba=({element:r,disabled:e,widgetMgr:t,fragmentId:n})=>{const[a,i]=Ut({getStateFromWidgetMgr:ua,getDefaultStateFromProto:da,getCurrStateFromProto:fa,updateWidgetMgrState:ga,element:r,widgetMgr:t,fragmentId:n}),o=C.useCallback(l=>{i({value:l,fromUi:!0})},[i]);return A(pa,{label:r.label,labelVisibility:Wt(r.labelVisibility?.value),help:r.help,onChange:o,disabled:e,value:a})},wa=C.memo(ba);export{wa as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,E as L,_ as D,L as Te,e as de,n as P,W as ie,bU as Le,bN as De,bM as Be,x as d,j as n,Z as Ve,l as F,B as We,ax as ze,b as Me,m as Ne,T as qe,P as Oe,ac as He}from"./index.CqTPbV5Y.js";import{u as $e}from"./useWaveformController.BCmk6WLk.js";import{T as je,a as ce}from"./Toolbar.DMgU0Vgw.js";import{u as _e,F as Xe}from"./FormClearHelper.-9RbsnV0.js";import{c as Ge}from"./createDownloadLinkElement.ZaXNnPK4.js";import{E as Ke}from"./urls.BwSlolu9.js";import{F as Ze,D as Je}from"./FileDownload.esm.CV-WYqBn.js";var ue=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),t.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});ue.displayName="Mic";var fe=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});fe.displayName="Pause";var pe=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});pe.displayName="PlayArrow";var me=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),t.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});me.displayName="Refresh";var ge=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});ge.displayName="StopCircle";const Qe=(e,r)=>{const{enforceDownloadInNewTab:o=!1}=t.useContext(Te);return t.useCallback(()=>{if(!e)return;const l=Ge({enforceDownloadInNewTab:o,url:e,filename:r});l.style.display="none",document.body.appendChild(l),l.click(),document.body.removeChild(l)},[e,o,r])},H=({widgetMgr:e,id:r,formId:o,key:c,defaultValue:l})=>{t.useEffect(()=>{const s=e.getElementState(r,c);de(s)&&P(l)&&e.setElementState(r,c,l)},[e,r,c,l]);const[S,u]=t.useState(e.getElementState(r,c)??l),h=t.useCallback(s=>{e.setElementState(r,c,s),u(s)},[e,r,c]),y=t.useMemo(()=>({formId:o||""}),[o]),b=t.useCallback(()=>h(l),[l,h]);return _e({element:y,widgetMgr:e,onFormCleared:b}),[S,h]},Ye=async({files:e,uploadClient:r,widgetMgr:o,widgetInfo:c,fragmentId:l,signal:S})=>{let u=[];try{u=await r.fetchFileURLs(e)}catch(s){return{successfulUploads:[],failedUploads:e.map(i=>({file:i,error:ie(s)}))}}const h=Le(e,u),y=[],b=[];return await Promise.all(h.map(async([s,i])=>{if(!s||!i?.uploadUrl||!i.fileId)return{file:s,fileUrl:i,error:new Error("No upload URL found")};try{await r.uploadFile({id:i.fileId,formId:c.formId||""},i.uploadUrl,s,void 0,S),y.push({fileUrl:i,file:s})}catch(N){const f=ie(N);b.push({file:s,error:f})}})),o.setFileUploaderStateValue(c,new De({uploadedFileInfo:y.map(({file:s,fileUrl:i})=>new Be({fileId:i.fileId,fileUrls:i,name:s.webkitRelativePath||s.name,size:s.size}))}),{fromUi:!0},l),{successfulUploads:y,failedUploads:b}},et=d("div",{target:"e3q8yfp0"})(),se=d("div",{target:"e3q8yfp1"})(({theme:e,disabled:r})=>({height:e.sizes.largestElementHeight,width:"100%",background:e.colors.secondaryBg,borderRadius:e.radii.default,marginBottom:e.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:e.spacing.xs,paddingRight:e.spacing.sm,border:e.colors.widgetBorderColor?`${e.sizes.borderWidth} solid ${e.colors.widgetBorderColor}`:void 0,cursor:r?"not-allowed":"auto",overflow:"hidden"})),tt=d("div",{target:"e3q8yfp2"})({flex:1}),rt=d("div",{target:"e3q8yfp3"})(({show:e,theme:r})=>({display:e?"block":"none",position:"relative",height:r.sizes.largestElementHeight,"& > div":{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center"}})),ot=d("span",{target:"e3q8yfp4"})(({theme:e,isPlayingOrRecording:r,disabled:o})=>({margin:e.spacing.sm,fontFamily:e.fonts.monospace,color:o?e.colors.fadedText40:r?e.colors.bodyText:e.colors.fadedText60,backgroundColor:e.colors.secondaryBg,fontSize:e.fontSizes.sm})),he=d("div",{target:"e3q8yfp5"})({width:"100%",textAlign:"center",overflow:"hidden"}),ye=d("span",{target:"e3q8yfp6"})(({theme:e})=>({color:e.colors.bodyText})),nt=d("a",{target:"e3q8yfp7"})(({theme:e})=>({color:e.colors.link,textDecoration:e.linkUnderline?"underline":"none"})),at=d("div",{target:"e3q8yfp8"})(({theme:e})=>({flex:1,height:e.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"})),lt=d("div",{target:"e3q8yfp9"})(({theme:e})=>{const r="0.625em";return{opacity:.2,width:"100%",height:r,backgroundSize:r,backgroundImage:`radial-gradient(${e.colors.fadedText10} 40%, transparent 40%)`,backgroundRepeat:"repeat"}}),it=d("span",{target:"e3q8yfp10"})(({theme:e})=>({"& > button":{color:e.colors.primary,padding:e.spacing.threeXS},"& > button:hover, & > button:focus":{color:e.colors.redColor}})),ct=d("span",{target:"e3q8yfp11"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}})),be=d("span",{target:"e3q8yfp12"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}})),$=d("div",{target:"e3q8yfp13"})(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:e.spacing.xs,gap:e.spacing.twoXS,marginRight:e.spacing.twoXS})),st=d("div",{target:"e3q8yfp14"})(({theme:e})=>({marginLeft:e.spacing.sm})),T=({onClick:e,disabled:r,ariaLabel:o,iconContent:c})=>n(Me,{kind:We.BORDERLESS_ICON,onClick:e,disabled:r,"aria-label":o,containerWidth:!0,"data-testid":"stAudioInputActionButton",children:n(ze,{content:c,size:"lg",color:"inherit"})}),dt=({disabled:e,stopRecording:r})=>n(it,{children:n(T,{onClick:r,disabled:e,ariaLabel:"Stop recording",iconContent:ge})}),ut=({disabled:e,isPlaying:r,onClickPlayPause:o})=>n(be,{children:r?n(T,{onClick:o,disabled:e,ariaLabel:"Pause",iconContent:fe}):n(T,{onClick:o,disabled:e,ariaLabel:"Play",iconContent:pe})}),ft=({disabled:e,startRecording:r})=>n(ct,{children:n(T,{onClick:r,disabled:e,ariaLabel:"Record",iconContent:ue})}),pt=({onClick:e})=>n(be,{children:n(T,{disabled:!1,onClick:e,ariaLabel:"Reset",iconContent:me})}),mt=({disabled:e,isRecording:r,isPlaying:o,isUploading:c,isError:l,recordingUrlExists:S,startRecording:u,stopRecording:h,onClickPlayPause:y,onClear:b})=>l?n($,{children:n(pt,{onClick:b})}):c?n($,{children:n(Ve,{size:"base",iconValue:"spinner"})}):F($,{children:[r?n(dt,{disabled:e,stopRecording:h}):n(ft,{disabled:e,startRecording:u}),S&&n(ut,{disabled:e,isPlaying:o,onClickPlayPause:y})]}),gt=t.memo(mt),ht=()=>n(he,{children:n(ye,{children:"An error has occurred, please try again."})}),yt=t.memo(ht),R="00:00",k=e=>{const r=Math.floor(e/1e3),o=Math.floor(r/60),c=Math.floor(o/60),l=r%60,S=o%60,u=l.toString().padStart(2,"0"),h=S.toString().padStart(2,"0"),y=c.toString().padStart(2,"0");return o<60?`${h}:${u}`:`${y}:${h}:${u}`},bt=()=>F(he,{children:[n(ye,{children:"This app would like to use your microphone."})," ",n(nt,{href:Ke,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]}),vt=t.memo(bt),St=()=>n(at,{children:n(lt,{})}),wt=t.memo(St),Ct=({element:e,uploadClient:r,widgetMgr:o,fragmentId:c,disabled:l})=>{const S=t.useRef(null),[u,h]=t.useState(!1),[y,b]=t.useState(!1),[s,i]=t.useState(!1),[N,f]=t.useState(R),[B,V]=H({widgetMgr:o,id:e.id,key:"deleteFileUrl",defaultValue:null}),[g,W]=H({widgetMgr:o,id:e.id,key:"recordingUrl",defaultValue:null}),[q,A]=H({widgetMgr:o,id:e.id,formId:e.formId,key:"recordingTime",defaultValue:R}),U=t.useRef(null),w=t.useRef(null),p=t.useRef(null),j=e.id,C=e.formId,ve=t.useCallback(async a=>{U.current&&U.current.abort();const v=new AbortController;U.current=v;try{if(b(!0),P(C)&&o.setFormsWithUploadsInProgress(new Set([C])),v.signal.aborted)return;let m;try{m=URL.createObjectURL(a),w.current&&w.current!==m&&URL.revokeObjectURL(w.current),w.current=m}catch{i(!0),b(!1),P(C)&&o.setFormsWithUploadsInProgress(new Set);return}if(v.signal.aborted){URL.revokeObjectURL(m),w.current=null;return}W(m);const Ie=new Date().toISOString().slice(0,16).replace(/:/g,"-"),Pe=new File([a],`${Ie}_audio.wav`,{type:a.type});try{const{successfulUploads:Fe,failedUploads:xe}=await Ye({files:[Pe],uploadClient:r,widgetMgr:o,widgetInfo:{id:j,formId:C},fragmentId:c,signal:v.signal});if(v.signal.aborted)return;if(xe.length>0){i(!0);return}i(!1);const le=Fe[0];le?.fileUrl?.deleteUrl&&V(le.fileUrl.deleteUrl)}catch{v.signal.aborted||i(!0)}finally{P(C)&&o.setFormsWithUploadsInProgress(new Set),v.signal.aborted||b(!1)}}catch{v.signal.aborted||(i(!0),b(!1)),P(C)&&o.setFormsWithUploadsInProgress(new Set)}},[r,o,j,C,c,V,W]),z=t.useRef(null),_=$e({containerRef:S,sampleRate:e.sampleRate??void 0,waveformPadding:4,events:{onPermissionDenied:()=>{h(!0)},onError:()=>{i(!0)},onRecordStart:()=>{A(R),f(R)},onRecordReady:()=>{const a=k(z.current?.playback.getDurationMs()??0);A(a),f(a)},onApprove:ve,onCancel:()=>{A(R),f(R)},onProgressMs:a=>{A(k(a))},onPlaybackPause:()=>{f(k(z.current?.playback.getCurrentTimeMs()??0))},onPlaybackFinish:()=>{f(k(z.current?.playback.getDurationMs()??0))}}});z.current=_;const{state:M,isPlaybackPlaying:I,start:X,stop:G,approve:K,cancel:Z,playback:{play:J,pause:Q,load:Y,getCurrentTimeMs:x,getDurationMs:ee}}=_,E=t.useCallback(async({updateWidgetManager:a,deleteFile:v})=>{const m=g;if(m&&w.current===m&&(URL.revokeObjectURL(m),w.current=null),p.current&&(cancelAnimationFrame(p.current),p.current=null),W(null),V(null),f(R),A(R),Z(),a&&o.setFileUploaderStateValue(e,{},{fromUi:!0},c),v&&B)try{await r.deleteFile(B)}catch{}P(m)&&URL.revokeObjectURL(m)},[B,g,r,Z,e,o,c,A,V,W]);t.useEffect(()=>{const a=()=>{I&&(f(k(x())),p.current=requestAnimationFrame(a))};return I?p.current=requestAnimationFrame(a):p.current&&(cancelAnimationFrame(p.current),p.current=null),()=>{p.current&&(cancelAnimationFrame(p.current),p.current=null)}},[I,x]),t.useEffect(()=>{if(!g)return;let a=!1;return f(q),(async()=>{try{if(await Y(g),a)return;const m=ee();m>0&&f(k(m))}catch{a||i(!0)}})(),()=>{a=!0}},[g,q,Y,ee]),t.useEffect(()=>{if(de(C))return;const a=new Xe;return a.manageFormClearListener(o,C,()=>{E({updateWidgetManager:!0,deleteFile:!1})}),()=>a.disconnect()},[C,E,o]),t.useEffect(()=>()=>{U.current&&(U.current.abort(),U.current=null),p.current&&(cancelAnimationFrame(p.current),p.current=null),w.current&&(URL.revokeObjectURL(w.current),w.current=null)},[]);const Se=t.useCallback(async()=>{try{if(I){const a=x();Q(),f(k(a))}else M==="idle"&&g&&(x()<=100&&f(R),await J())}catch{i(!0)}},[I,x,Q,J,g,M]),te=t.useCallback(async()=>{g&&await E({updateWidgetManager:!1,deleteFile:!0});try{f(R),await X()}catch{}},[E,g,X]),re=t.useCallback(async()=>{try{const{blob:a}=await G();await K(a)}catch{i(!0)}},[K,G]),oe=Qe(g,"recording.wav"),we=t.useCallback(()=>{te()},[te]),Ce=t.useCallback(()=>{re()},[re]),Re=t.useCallback(()=>{E({updateWidgetManager:!1,deleteFile:!0}),i(!1)},[E]),Ee=t.useCallback(()=>{oe()},[oe]),ke=t.useCallback(()=>{E({updateWidgetManager:!0,deleteFile:!0})},[E]),O=M==="recording",ne=I,Ae=O?q:N,ae=M==="idle"&&!u&&!g,Ue=u||ae||s;return F(et,{className:"stAudioInput","data-testid":"stAudioInput",children:[n(He,{label:e.label,disabled:l,labelVisibility:Ne(e.labelVisibility?.value),children:e.help&&n(st,{children:n(qe,{content:e.help,placement:Oe.TOP})})}),F(se,{disabled:l,children:[F(je,{isFullScreen:!1,disableFullscreenMode:!0,target:se,children:[g&&n(ce,{label:"Download as WAV",icon:Ze,onClick:Ee}),B&&n(ce,{label:"Clear recording",icon:Je,onClick:ke})]}),n(gt,{isRecording:O,isPlaying:ne,isUploading:y,isError:s,recordingUrlExists:!!g,startRecording:we,stopRecording:Ce,onClickPlayPause:()=>void Se(),onClear:Re,disabled:l||u}),F(tt,{children:[s&&n(yt,{}),ae&&n(wt,{}),u&&n(vt,{}),n(rt,{"data-testid":"stAudioInputWaveSurfer",ref:S,show:!Ue})]}),n(ot,{isPlayingOrRecording:O||ne,disabled:l,"data-testid":"stAudioInputWaveformTimeCode",children:Ae})]})]})},Ft=t.memo(Ct);export{Ft as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as y,E as O,_ as T,x as I,t as X,l as x,j as h,ay as Q,P as j,b as J,B as K,ax as W,bK as B,al as Y,ag as Z,bm as ee,g as te,bL as re,Q as ie,bn as oe,e as P,bM as ne,bN as ae,m as se,ab as le,T as de,ac as ce,a0 as ue}from"./index.CqTPbV5Y.js";import{w as fe}from"./withCalculatedWidth.ChdrMItN.js";import{U as z}from"./UploadFileInfo.C-jY39rj.js";import{F as pe}from"./FormClearHelper.-9RbsnV0.js";import{P as he,S as ge}from"./ProgressBar.BxmfHxKu.js";import{b as me}from"./urls.BwSlolu9.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"})),we=I("span",{target:"etzmx8d5"})({display:"flex",alignItems:"center"}),Ce=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 x(Ue,{disabled:i||!1,onClick:l||(()=>{}),progress:n||null,"data-testid":"stCameraInputButton",children:[t,n?h(Me,{children:h(he,{value:n,size:ge.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})=>h(Ce,{"data-testid":"stCameraInputSwitchButton",children:h(Q,{content:"Switch camera",placement:j.TOP_RIGHT,children:h(J,{kind:K.MINIMAL,onClick:i,children:h(W,{content:k,size:"twoXL",color:B.white})})})}),xe=y.memo(Ee);var _={exports:{}},Fe=_.exports,L;function Pe(){return L||(L=1,function(i,l){(function(n,o){i.exports=o(Y())})(Fe,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),w=e.minScreenshotWidth!==r.minScreenshotWidth,S=e.minScreenshotHeight!==r.minScreenshotHeight;(c||w||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 w=this.getCanvas(e);return w&&w.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 w=this.video.videoWidth,S=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var v=w/S;w=c.minScreenshotWidth||this.video.clientWidth,S=w/v,c.minScreenshotHeight&&S<c.minScreenshotHeight&&(S=c.minScreenshotHeight,w=S*v)}this.canvas=document.createElement("canvas"),this.canvas.width=e?.width||w,this.canvas.height=e?.height||S,this.ctx=this.canvas.getContext("2d")}var C=this,b=C.ctx,p=C.canvas;return b&&p&&(p.width=e?.width||p.width,p.height=e?.height||p.height,c.mirrored&&(b.translate(p.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=c.imageSmoothing,b.drawImage(this.video,0,0,e?.width||p.width,e?.height||p.height),c.mirrored&&(b.scale(-1,1),b.translate(-p.width,0))),p},u.prototype.requestUserMedia=function(){var e=this,r=this.props,d=function(S,v){var C={video:typeof v<"u"?v:!0};r.audio&&(C.audio=typeof S<"u"?S:!0),e.requestUserMediaId++;var b=e.requestUserMediaId;navigator.mediaDevices.getUserMedia(C).then(function(p){e.unmounted||b!==e.requestUserMediaId?u.stopMediaStream(p):e.handleUserMedia(null,p)}).catch(function(p){e.handleUserMedia(p)})};if("mediaDevices"in navigator)d(r.audioConstraints,r.videoConstraints);else{var c=function(S){return{optional:[{sourceId:S}]}},w=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,C=null;S.forEach(function(F){F.kind==="audio"?v=F.id:F.kind==="video"&&(C=F.id)});var b=w(r.audioConstraints);b&&(v=b);var p=w(r.videoConstraints);p&&(C=p),d(c(v),c(C))})}},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,w=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,C=c.style,b=C===void 0?{}:C,p=c.children,F=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:!w,playsInline:!0,ref:function(q){e.video=q},style:D},F)),p&&p(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})=>x(V,{width:i,children:[h(W,{size:"threeXL",color:B.gray60,content:$}),x(Se,{children:["This app would like to use your camera.",h(be,{href:me,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 x(N,{"data-testid":"stCameraInputWebcamComponent",children:[g!=="success"&&!t&&!n?h(Oe,{width:E}):re()&&h(xe,{switchFacingMode:s}),h(V,{"data-testid":"stCameraInputWebcamStyledBox",hidden:g!=="success"&&!t&&!n,width:E,children:!t&&h(_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}})}),h(H,{onClick:e,disabled:g!=="success"||t||n,children:"Take Photo"})]})},We=y.memo(Te),Ve=150,ze=ie.getLogger("CameraInput");class Le 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 je(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);oe(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 ne({fileId:a.fileId,fileUrls:a.fileUrls,name:n,size:o})});return new ae({uploadedFileInfo:l})}render(){const{element:l,widgetMgr:t,disabled:n,width:o}=this.props;return this.formClearHelper.manageFormClearListener(t,l.formId,this.onFormCleared),x(N,{className:"stCameraInput","data-testid":"stCameraInput",children:[h(ce,{label:l.label,disabled:n,labelVisibility:se(l.labelVisibility?.value),children:l.help&&h(le,{children:h(de,{content:l.help,placement:j.TOP_RIGHT})})}),this.state.imgSrc?x(ue,{children:[h(V,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&h(ye,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:o*9/16})}),h(H,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||n,children:this.getProgress()?"Uploading...":x(we,{children:[h(W,{content:A,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):h(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 je(i,l){return fetch(i).then(t=>t.arrayBuffer()).then(t=>new File([t],l,{type:"image/jpeg"}))}const De=fe(Le);export{De as default};
|