streamlit-nightly 1.53.2.dev20260202__py3-none-any.whl → 1.54.1.dev20260204__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/commands/logo.py +6 -10
- streamlit/components/v2/component_path_utils.py +17 -29
- streamlit/config.py +4 -2
- streamlit/elements/arrow.py +66 -26
- streamlit/elements/lib/built_in_chart_utils.py +1 -1
- streamlit/elements/lib/column_config_utils.py +4 -4
- streamlit/elements/lib/options_selector_utils.py +4 -0
- streamlit/elements/lib/pandas_styler_utils.py +22 -22
- streamlit/elements/widgets/button_group.py +221 -86
- streamlit/elements/widgets/data_editor.py +9 -9
- streamlit/elements/widgets/radio.py +8 -4
- streamlit/hello/dataframe_demo.py +1 -1
- streamlit/path_security.py +98 -0
- streamlit/proto/ArrowData_pb2.py +5 -3
- streamlit/proto/ArrowData_pb2.pyi +44 -4
- streamlit/proto/ArrowNamedDataSet_pb2.py +4 -4
- streamlit/proto/ArrowNamedDataSet_pb2.pyi +3 -3
- streamlit/proto/ArrowVegaLiteChart_pb2.py +4 -4
- streamlit/proto/ArrowVegaLiteChart_pb2.pyi +3 -3
- streamlit/proto/ButtonGroup_pb2.py +8 -8
- streamlit/proto/ButtonGroup_pb2.pyi +9 -7
- streamlit/proto/Dataframe_pb2.py +31 -0
- streamlit/proto/{Arrow_pb2.pyi → Dataframe_pb2.pyi} +39 -102
- streamlit/proto/Element_pb2.py +5 -4
- streamlit/proto/Element_pb2.pyi +11 -10
- streamlit/proto/Table_pb2.py +29 -0
- streamlit/proto/Table_pb2.pyi +83 -0
- streamlit/runtime/app_session.py +9 -1
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +307 -307
- streamlit/static/static/js/{ErrorOutline.esm.CLuz0rSD.js → ErrorOutline.esm.DWBqsdHn.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.CO68LcnZ.js → FileDownload.esm.D5koxJhf.js} +1 -1
- streamlit/static/static/js/{FileHelper.DAXgY6Ug.js → FileHelper.kJKftfu4.js} +5 -5
- streamlit/static/static/js/{FormClearHelper.zxJ53Nym.js → FormClearHelper.CyGGPn10.js} +1 -1
- streamlit/static/static/js/{InputInstructions.CCbg8esE.js → InputInstructions.oezYb8Lm.js} +1 -1
- streamlit/static/static/js/{Particles.BJw0A-zv.js → Particles.BIpBmEwi.js} +1 -1
- streamlit/static/static/js/{ProgressBar.BrrHeAEh.js → ProgressBar.BRAS_FJc.js} +1 -1
- streamlit/static/static/js/{StreamlitSyntaxHighlighter.DvPLy3zk.js → StreamlitSyntaxHighlighter.c2qcx-xG.js} +2 -2
- streamlit/static/static/js/{TableChart.esm.BawvAi5p.js → TableChart.esm.BuemQLVW.js} +1 -1
- streamlit/static/static/js/{Toolbar.CbpscbNb.js → Toolbar.mUe2Nmta.js} +1 -1
- streamlit/static/static/js/{WidgetLabelHelpIconInline.DA4S2HFP.js → WidgetLabelHelpIconInline.if89y2mu.js} +1 -1
- streamlit/static/static/js/{base-input.BKKl2eBF.js → base-input.AJ4KxBTh.js} +4 -4
- streamlit/static/static/js/{checkbox.CB43AKV4.js → checkbox.GY4JoJkM.js} +1 -1
- streamlit/static/static/js/{createDownloadLinkElement.jVwF96ey.js → createDownloadLinkElement.BWJh90jh.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.CxQizSv7.js → data-grid-overlay-editor.C9AINtRf.js} +1 -1
- streamlit/static/static/js/{downloader.CKlIgsy5.js → downloader.BZY8OE4f.js} +1 -1
- streamlit/static/static/js/{embed.BhRb_2n8.js → embed.BjO7Ez0y.js} +1 -1
- streamlit/static/static/js/{es6.DPyfPmWm.js → es6.eb5oR8iN.js} +2 -2
- streamlit/static/static/js/{formatNumber.DtfMnnPx.js → formatNumber.CCeQsvJQ.js} +1 -1
- streamlit/static/static/js/{iconPosition.DkZAlu_k.js → iconPosition.D6eEnKvO.js} +1 -1
- streamlit/static/static/js/{iframeResizer.contentWindow.l5sQWLra.js → iframeResizer.contentWindow.DTsWJRTo.js} +1 -1
- streamlit/static/static/js/{index.rvbQETlC.js → index.B6l4FdUv.js} +1 -1
- streamlit/static/static/js/{index.BUlT_mOL.js → index.B7H2q9vo.js} +2 -2
- streamlit/static/static/js/{index.CsIENsKH.js → index.BDdmrM58.js} +1 -1
- streamlit/static/static/js/{index.e6Ry6-Ft.js → index.BMbQnwRD.js} +1 -1
- streamlit/static/static/js/{index.CL_icBXS.js → index.BQ5MOzHu.js} +1 -1
- streamlit/static/static/js/{index.Ccye_uLl.js → index.BSgo_bkv.js} +1 -1
- streamlit/static/static/js/{index.LjqoQCm5.js → index.BU5M9DsN.js} +1 -1
- streamlit/static/static/js/{index.Bc_FQ4Wb.js → index.BYIxnU34.js} +1 -1
- streamlit/static/static/js/{index.y0h42OXL.js → index.BZL2hIBz.js} +1 -1
- streamlit/static/static/js/{index.Dac9Jib-.js → index.BZVrJlnq.js} +1 -1
- streamlit/static/static/js/{index.BLD3tJ2C.js → index.Bd7QK46M.js} +1 -1
- streamlit/static/static/js/{index.Ck64OQhV.js → index.BfHA_i34.js} +1 -1
- streamlit/static/static/js/{index.BpCj2-sQ.js → index.Bgry-Ek_.js} +1 -1
- streamlit/static/static/js/{index.D83azq2w.js → index.Bi25zaXA.js} +1 -1
- streamlit/static/static/js/{index.Cwg8nWw5.js → index.Bj3M1xBC.js} +1 -1
- streamlit/static/static/js/{index.DmWUXdjc.js → index.Bjrvlqx5.js} +16 -16
- streamlit/static/static/js/index.BnOSeM5K.js +11 -0
- streamlit/static/static/js/index.BoL6J1jK.js +2 -0
- streamlit/static/static/js/{index.yHLCvUGh.js → index.BoORyxOa.js} +1 -1
- streamlit/static/static/js/{index.DiBeetOH.js → index.Bpd7GPeH.js} +1 -1
- streamlit/static/static/js/{index.BzO83wKm.js → index.BpeJX018.js} +1 -1
- streamlit/static/static/js/{index.C_19KWNs.js → index.BriH7JVk.js} +1 -1
- streamlit/static/static/js/{index.DjuMEZ6m.js → index.BwkeObMo.js} +1 -1
- streamlit/static/static/js/{index.CiS4giQ2.js → index.C0o85qmd.js} +1 -1
- streamlit/static/static/js/{index.L9pOjBEn.js → index.C7_wNJTH.js} +2 -2
- streamlit/static/static/js/{index.DzdPUxsx.js → index.CGZP_w9b.js} +1 -1
- streamlit/static/static/js/{index.DKoJr0Se.js → index.CGw52-0-.js} +1 -1
- streamlit/static/static/js/{index.6J1N4is3.js → index.CUvtJj0a.js} +1 -1
- streamlit/static/static/js/{index.CBbYMKZp.js → index.Cfx1ZHWt.js} +1 -1
- streamlit/static/static/js/{index.BAK0CG1Q.js → index.Chl2kALe.js} +1 -1
- streamlit/static/static/js/index.Crlx_wdE.js +1 -0
- streamlit/static/static/js/{index.WIMtx3m0.js → index.D9A-8ebQ.js} +1 -1
- streamlit/static/static/js/{index.y5HxPwg9.js → index.DBIoNOen.js} +21 -21
- streamlit/static/static/js/{index.AZ9T4EqJ.js → index.DMKTAe4F.js} +1 -1
- streamlit/static/static/js/{index.YutgmD9x.js → index.DNrpqKVt.js} +2 -2
- streamlit/static/static/js/{index.Y9wPTZIf.js → index.DSRvF_8e.js} +1 -1
- streamlit/static/static/js/{index.DZOGT9vX.js → index.DhB1m_xG.js} +1 -1
- streamlit/static/static/js/{index.DR6V0uBJ.js → index.DiES30vM.js} +1 -1
- streamlit/static/static/js/{index.CmbqbRMZ.js → index.DlJ4Y1xc.js} +1 -1
- streamlit/static/static/js/{index.FioS1Y9m.js → index.J61yByUR.js} +1 -1
- streamlit/static/static/js/{index.hnu9U-5g.js → index.JxDTXE8N.js} +1 -1
- streamlit/static/static/js/{index.CaU3Uv_L.js → index.KGr28TP8.js} +1 -1
- streamlit/static/static/js/{index.465nmxtO.js → index.Pgm3rRpH.js} +1 -1
- streamlit/static/static/js/{index.DpSc4e1j.js → index.XzcYOc9I.js} +1 -1
- streamlit/static/static/js/{index.OizPL4jg.js → index.Z_u7ZS4h.js} +1 -1
- streamlit/static/static/js/{index.CL7it7tU.js → index.hDg7x0Tp.js} +1 -1
- streamlit/static/static/js/{index.b_f-McZ5.js → index.k7p0hmaU.js} +1 -1
- streamlit/static/static/js/{index.CsEZTo6L.js → index.syoxWolF.js} +1 -1
- streamlit/static/static/js/{index.Q2t_iBn0.js → index.xZ651bTg.js} +1 -1
- streamlit/static/static/js/{input.CAtwSQ27.js → input.C-PwAMG6.js} +1 -1
- streamlit/static/static/js/{main.VeMVx6VI.js → main.fMmyxXOf.js} +1 -1
- streamlit/static/static/js/{memory.CxS_lIUn.js → memory.BG__eDEj.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.CoqRgZW_.js → number-overlay-editor.C0n-91sR.js} +1 -1
- streamlit/static/static/js/{pandasStylerUtils.DGWgd5sM.js → pandasStylerUtils.BqWaUzvh.js} +1 -1
- streamlit/static/static/js/{sandbox.2mSqEau0.js → sandbox.CHhc-txg.js} +1 -1
- streamlit/static/static/js/{sprintfjs.CsoVVZ9k.js → sprintfjs.BlFBKfMf.js} +1 -1
- streamlit/static/static/js/{styled-components.BShfh7J8.js → styled-components.D5uOQqN2.js} +1 -1
- streamlit/static/static/js/{throttle.Fq1DQK4p.js → throttle.DlZC3xNA.js} +1 -1
- streamlit/static/static/js/{timepicker.DmyY-qtn.js → timepicker._TfRUaDL.js} +4 -4
- streamlit/static/static/js/{toConsumableArray.Dvd9AIqV.js → toConsumableArray.CZW4AmuW.js} +2 -2
- streamlit/static/static/js/uniqueId.CTTDAAaF.js +1 -0
- streamlit/static/static/js/useBasicWidgetState.Bx27912z.js +1 -0
- streamlit/static/static/js/{useIntlLocale.kdIj0ego.js → useIntlLocale.DsOvysl7.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.DkuG1C1S.js → useTextInputAutoExpand.C9g8px1W.js} +1 -1
- streamlit/static/static/js/{useUpdateUiValue.-UI_JsjT.js → useUpdateUiValue.fF-Cntkp.js} +1 -1
- streamlit/static/static/js/{useWaveformController.C5PTwL6I.js → useWaveformController.C5EtFoJE.js} +1 -1
- streamlit/static/static/js/{withCalculatedWidth.BREyS0pJ.js → withCalculatedWidth.CcvaXQb0.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.DYDiEOrW.js → withFullScreenWrapper.DP61hzLF.js} +1 -1
- streamlit/testing/v1/element_tree.py +20 -15
- streamlit/web/server/app_static_file_handler.py +9 -0
- streamlit/web/server/bidi_component_request_handler.py +4 -4
- streamlit/web/server/component_file_utils.py +14 -6
- streamlit/web/server/component_request_handler.py +2 -2
- streamlit/web/server/routes.py +14 -0
- streamlit/web/server/server.py +4 -0
- streamlit/web/server/starlette/starlette_app.py +7 -1
- streamlit/web/server/starlette/starlette_path_security_middleware.py +97 -0
- streamlit/web/server/starlette/starlette_routes.py +6 -3
- streamlit/web/server/starlette/starlette_static_routes.py +14 -4
- {streamlit_nightly-1.53.2.dev20260202.dist-info → streamlit_nightly-1.54.1.dev20260204.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.53.2.dev20260202.dist-info → streamlit_nightly-1.54.1.dev20260204.dist-info}/RECORD +135 -131
- streamlit/proto/Arrow_pb2.py +0 -34
- streamlit/static/static/js/index.CAoX2tlo.js +0 -2
- streamlit/static/static/js/index.DDr-BLbJ.js +0 -1
- streamlit/static/static/js/index.DL_ywOgf.js +0 -11
- streamlit/static/static/js/uniqueId.CCajdEK8.js +0 -1
- streamlit/static/static/js/useBasicWidgetState.COLQ5AFB.js +0 -1
- {streamlit_nightly-1.53.2.dev20260202.dist-info → streamlit_nightly-1.54.1.dev20260204.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.53.2.dev20260202.dist-info → streamlit_nightly-1.54.1.dev20260204.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.53.2.dev20260202.dist-info → streamlit_nightly-1.54.1.dev20260204.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as O,
|
|
1
|
+
import{r as O,bl as Hr,bm as Ar,bn as Er,bo as Rr,an as Xr,cB as Qr,ai as Jr,ao as X,aq as Ae,ar as Ee,cC as Zr,ap as Lr,w as W,aM as Tr,cD as Gr,av as xr,ax as ir,bV as en,bg as Ne,bq as tn,br as rn,b4 as nn,ay as an,aL as on}from"./index.DBIoNOen.js";import{D as Ce,a as Ie,T as sn}from"./timepicker._TfRUaDL.js";import{I as ln}from"./input.C-PwAMG6.js";import{d as un}from"./base-input.AJ4KxBTh.js";var cn=["title","size","color","overrides"];function ht(){return ht=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},ht.apply(this,arguments)}function dn(t,r){if(t==null)return{};var n=pn(t,r),a,e;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(e=0;e<o.length;e++)a=o[e],!(r.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(t,a)&&(n[a]=t[a])}return n}function pn(t,r){if(t==null)return{};var n={},a=Object.keys(t),e,o;for(o=0;o<a.length;o++)e=a[o],!(r.indexOf(e)>=0)&&(n[e]=t[e]);return n}function fn(t,r){return gn(t)||vn(t,r)||yn(t,r)||hn()}function hn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yn(t,r){if(t){if(typeof t=="string")return sr(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sr(t,r)}}function sr(t,r){(r==null||r>t.length)&&(r=t.length);for(var n=0,a=new Array(r);n<r;n++)a[n]=t[n];return a}function vn(t,r){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var a=[],e=!0,o=!1,i,s;try{for(n=n.call(t);!(e=(i=n.next()).done)&&(a.push(i.value),!(r&&a.length===r));e=!0);}catch(u){o=!0,s=u}finally{try{!e&&n.return!=null&&n.return()}finally{if(o)throw s}}return a}}function gn(t){if(Array.isArray(t))return t}function mn(t,r){var n=Hr(),a=fn(n,2),e=a[1],o=t.title,i=o===void 0?"Left":o,s=t.size,u=t.color,c=t.overrides,h=c===void 0?{}:c,d=dn(t,cn),m=Ar({component:e.icons&&e.icons.ChevronLeft?e.icons.ChevronLeft:null},h&&h.Svg?Er(h.Svg):{});return O.createElement(Rr,ht({viewBox:"0 0 24 24",ref:r,title:i,size:s,color:u,overrides:{Svg:m}},d),O.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 12C9 12.2652 9.10536 12.5196 9.29289 12.7071L13.2929 16.7071C13.6834 17.0976 14.3166 17.0976 14.7071 16.7071C15.0976 16.3166 15.0976 15.6834 14.7071 15.2929L11.4142 12L14.7071 8.70711C15.0976 8.31658 15.0976 7.68342 14.7071 7.29289C14.3166 6.90237 13.6834 6.90237 13.2929 7.29289L9.29289 11.2929C9.10536 11.4804 9 11.7348 9 12Z"}))}const lr=O.forwardRef(mn);var bn=["title","size","color","overrides"];function yt(){return yt=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},yt.apply(this,arguments)}function On(t,r){if(t==null)return{};var n=Sn(t,r),a,e;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(e=0;e<o.length;e++)a=o[e],!(r.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(t,a)&&(n[a]=t[a])}return n}function Sn(t,r){if(t==null)return{};var n={},a=Object.keys(t),e,o;for(o=0;o<a.length;o++)e=a[o],!(r.indexOf(e)>=0)&&(n[e]=t[e]);return n}function Dn(t,r){return kn(t)||wn(t,r)||$n(t,r)||_n()}function _n(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $n(t,r){if(t){if(typeof t=="string")return ur(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ur(t,r)}}function ur(t,r){(r==null||r>t.length)&&(r=t.length);for(var n=0,a=new Array(r);n<r;n++)a[n]=t[n];return a}function wn(t,r){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var a=[],e=!0,o=!1,i,s;try{for(n=n.call(t);!(e=(i=n.next()).done)&&(a.push(i.value),!(r&&a.length===r));e=!0);}catch(u){o=!0,s=u}finally{try{!e&&n.return!=null&&n.return()}finally{if(o)throw s}}return a}}function kn(t){if(Array.isArray(t))return t}function Pn(t,r){var n=Hr(),a=Dn(n,2),e=a[1],o=t.title,i=o===void 0?"Right":o,s=t.size,u=t.color,c=t.overrides,h=c===void 0?{}:c,d=On(t,bn),m=Ar({component:e.icons&&e.icons.ChevronRight?e.icons.ChevronRight:null},h&&h.Svg?Er(h.Svg):{});return O.createElement(Rr,yt({viewBox:"0 0 24 24",ref:r,title:i,size:s,color:u,overrides:{Svg:m}},d),O.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.29289 7.29289C8.90237 7.68342 8.90237 8.31658 9.29289 8.70711L12.5858 12L9.29289 15.2929C8.90237 15.6834 8.90237 16.3166 9.29289 16.7071C9.68342 17.0976 10.3166 17.0976 10.7071 16.7071L14.7071 12.7071C14.8946 12.5196 15 12.2652 15 12C15 11.7348 14.8946 11.4804 14.7071 11.2929L10.7071 7.29289C10.3166 6.90237 9.68342 6.90237 9.29289 7.29289Z"}))}const cr=O.forwardRef(Pn);var rt={exports:{}},nt,dr;function Mn(){if(dr)return nt;dr=1;function t(p){return p&&typeof p=="object"&&"default"in p?p.default:p}var r=t(Xr()),n=Qr();function a(p,v){for(var D=Object.getOwnPropertyNames(v),f=0;f<D.length;f++){var l=D[f],M=Object.getOwnPropertyDescriptor(v,l);M&&M.configurable&&p[l]===void 0&&Object.defineProperty(p,l,M)}return p}function e(){return(e=Object.assign||function(p){for(var v=1;v<arguments.length;v++){var D=arguments[v];for(var f in D)Object.prototype.hasOwnProperty.call(D,f)&&(p[f]=D[f])}return p}).apply(this,arguments)}function o(p,v){p.prototype=Object.create(v.prototype),a(p.prototype.constructor=p,v)}function i(p,v){if(p==null)return{};var D,f,l={},M=Object.keys(p);for(f=0;f<M.length;f++)D=M[f],0<=v.indexOf(D)||(l[D]=p[D]);return l}function s(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}var u=function(p,v,D,f,l,M,Y,te){if(!p){var E;if(v===void 0)E=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var L=[D,f,l,M,Y,te],N=0;(E=new Error(v.replace(/%s/g,function(){return L[N++]}))).name="Invariant Violation"}throw E.framesToPop=1,E}},c=u;function h(p,v,D){if("selectionStart"in p&&"selectionEnd"in p)p.selectionStart=v,p.selectionEnd=D;else{var f=p.createTextRange();f.collapse(!0),f.moveStart("character",v),f.moveEnd("character",D-v),f.select()}}function d(p){var v=0,D=0;if("selectionStart"in p&&"selectionEnd"in p)v=p.selectionStart,D=p.selectionEnd;else{var f=document.selection.createRange();f.parentElement()===p&&(v=-f.moveStart("character",-p.value.length),D=-f.moveEnd("character",-p.value.length))}return{start:v,end:D,length:D-v}}var m={9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},g="_";function y(p,v,D){var f="",l="",M=null,Y=[];if(v===void 0&&(v=g),D==null&&(D=m),!p||typeof p!="string")return{maskChar:v,formatChars:D,mask:null,prefix:null,lastEditablePosition:null,permanents:[]};var te=!1;return p.split("").forEach(function(E){te=!te&&E==="\\"||(te||!D[E]?(Y.push(f.length),f.length===Y.length-1&&(l+=E)):M=f.length+1,f+=E,!1)}),{maskChar:v,formatChars:D,prefix:l,mask:f,lastEditablePosition:M,permanents:Y}}function b(p,v){return p.permanents.indexOf(v)!==-1}function S(p,v,D){var f=p.mask,l=p.formatChars;if(!D)return!1;if(b(p,v))return f[v]===D;var M=l[f[v]];return new RegExp(M).test(D)}function $(p,v){return v.split("").every(function(D,f){return b(p,f)||!S(p,f,D)})}function _(p,v){var D=p.maskChar,f=p.prefix;if(!D){for(;v.length>f.length&&b(p,v.length-1);)v=v.slice(0,v.length-1);return v.length}for(var l=f.length,M=v.length;M>=f.length;M--){var Y=v[M];if(!b(p,M)&&S(p,M,Y)){l=M+1;break}}return l}function k(p,v){return _(p,v)===p.mask.length}function w(p,v){var D=p.maskChar,f=p.mask,l=p.prefix;if(!D){for((v=A(p,"",v,0)).length<l.length&&(v=l);v.length<f.length&&b(p,v.length);)v+=f[v.length];return v}if(v)return A(p,w(p,""),v,0);for(var M=0;M<f.length;M++)b(p,M)?v+=f[M]:v+=D;return v}function j(p,v,D,f){var l=D+f,M=p.maskChar,Y=p.mask,te=p.prefix,E=v.split("");if(M)return E.map(function(N,re){return re<D||l<=re?N:b(p,re)?Y[re]:M}).join("");for(var L=l;L<E.length;L++)b(p,L)&&(E[L]="");return D=Math.max(te.length,D),E.splice(D,l-D),v=E.join(""),w(p,v)}function A(p,v,D,f){var l=p.mask,M=p.maskChar,Y=p.prefix,te=D.split(""),E=k(p,v);return!M&&f>v.length&&(v+=l.slice(v.length,f)),te.every(function(L){for(;ie=L,b(p,z=f)&&ie!==l[z];){if(f>=v.length&&(v+=l[f]),N=L,re=f,M&&b(p,re)&&N===M)return!0;if(++f>=l.length)return!1}var N,re,z,ie;return!S(p,f,L)&&L!==M||(f<v.length?v=M||E||f<Y.length?v.slice(0,f)+L+v.slice(f+1):(v=v.slice(0,f)+L+v.slice(f),w(p,v)):M||(v+=L),++f<l.length)}),v}function T(p,v,D,f){var l=p.mask,M=p.maskChar,Y=D.split(""),te=f;return Y.every(function(E){for(;N=E,b(p,L=f)&&N!==l[L];)if(++f>=l.length)return!1;var L,N;return(S(p,f,E)||E===M)&&f++,f<l.length}),f-te}function F(p,v){for(var D=v;0<=D;--D)if(!b(p,D))return D;return null}function I(p,v){for(var D=p.mask,f=v;f<D.length;++f)if(!b(p,f))return f;return null}function B(p){return p||p===0?p+"":""}function H(p,v,D,f,l){var M=p.mask,Y=p.prefix,te=p.lastEditablePosition,E=v,L="",N=0,re=0,z=Math.min(l.start,D.start);return D.end>l.start?re=(N=T(p,f,L=E.slice(l.start,D.end),z))?l.length:0:E.length<f.length&&(re=f.length-E.length),E=f,re&&(re===1&&!l.length&&(z=l.start===D.start?I(p,D.start):F(p,D.start)),E=j(p,E,z,re)),E=A(p,E,L,z),(z+=N)>=M.length?z=M.length:z<Y.length&&!N?z=Y.length:z>=Y.length&&z<te&&N&&(z=I(p,z)),L||(L=null),{value:E=w(p,E),enteredString:L,selection:{start:z,end:z}}}function C(){var p=new RegExp("windows","i"),v=new RegExp("phone","i"),D=navigator.userAgent;return p.test(D)&&v.test(D)}function R(p){return typeof p=="function"}function U(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame}function ve(){return window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame}function oe(p){return(ve()?U():function(){return setTimeout(p,1e3/60)})(p)}function G(p){(ve()||clearTimeout)(p)}var ee=(function(p){function v(f){var l=p.call(this,f)||this;l.focused=!1,l.mounted=!1,l.previousSelection=null,l.selectionDeferId=null,l.saveSelectionLoopDeferId=null,l.saveSelectionLoop=function(){l.previousSelection=l.getSelection(),l.saveSelectionLoopDeferId=oe(l.saveSelectionLoop)},l.runSaveSelectionLoop=function(){l.saveSelectionLoopDeferId===null&&l.saveSelectionLoop()},l.stopSaveSelectionLoop=function(){l.saveSelectionLoopDeferId!==null&&(G(l.saveSelectionLoopDeferId),l.saveSelectionLoopDeferId=null,l.previousSelection=null)},l.getInputDOMNode=function(){if(!l.mounted)return null;var P=n.findDOMNode(s(s(l))),x=typeof window<"u"&&P instanceof window.Element;if(P&&!x)return null;if(P.nodeName!=="INPUT"&&(P=P.querySelector("input")),!P)throw new Error("react-input-mask: inputComponent doesn't contain input node");return P},l.getInputValue=function(){var P=l.getInputDOMNode();return P?P.value:null},l.setInputValue=function(P){var x=l.getInputDOMNode();x&&(l.value=P,x.value=P)},l.setCursorToEnd=function(){var P=_(l.maskOptions,l.value),x=I(l.maskOptions,P);x!==null&&l.setCursorPosition(x)},l.setSelection=function(P,x,q){q===void 0&&(q={});var V=l.getInputDOMNode(),Q=l.isFocused();V&&Q&&(q.deferred||h(V,P,x),l.selectionDeferId!==null&&G(l.selectionDeferId),l.selectionDeferId=oe(function(){l.selectionDeferId=null,h(V,P,x)}),l.previousSelection={start:P,end:x,length:Math.abs(x-P)})},l.getSelection=function(){return d(l.getInputDOMNode())},l.getCursorPosition=function(){return l.getSelection().start},l.setCursorPosition=function(P){l.setSelection(P,P)},l.isFocused=function(){return l.focused},l.getBeforeMaskedValueChangeConfig=function(){var P=l.maskOptions,x=P.mask,q=P.maskChar,V=P.permanents,Q=P.formatChars;return{mask:x,maskChar:q,permanents:V,alwaysShowMask:!!l.props.alwaysShowMask,formatChars:Q}},l.isInputAutofilled=function(P,x,q,V){var Q=l.getInputDOMNode();try{if(Q.matches(":-webkit-autofill"))return!0}catch{}return!l.focused||V.end<q.length&&x.end===P.length},l.onChange=function(P){var x=s(s(l)).beforePasteState,q=s(s(l)).previousSelection,V=l.props.beforeMaskedValueChange,Q=l.getInputValue(),fe=l.value,he=l.getSelection();l.isInputAutofilled(Q,he,fe,q)&&(fe=w(l.maskOptions,""),q={start:0,end:0,length:0}),x&&(q=x.selection,fe=x.value,he={start:q.start+Q.length,end:q.start+Q.length,length:0},Q=fe.slice(0,q.start)+Q+fe.slice(q.end),l.beforePasteState=null);var $e=H(l.maskOptions,Q,he,fe,q),Ve=$e.enteredString,me=$e.selection,ke=$e.value;if(R(V)){var He=V({value:ke,selection:me},{value:fe,selection:q},Ve,l.getBeforeMaskedValueChangeConfig());ke=He.value,me=He.selection}l.setInputValue(ke),R(l.props.onChange)&&l.props.onChange(P),l.isWindowsPhoneBrowser?l.setSelection(me.start,me.end,{deferred:!0}):l.setSelection(me.start,me.end)},l.onFocus=function(P){var x=l.props.beforeMaskedValueChange,q=l.maskOptions,V=q.mask,Q=q.prefix;if(l.focused=!0,l.mounted=!0,V){if(l.value)_(l.maskOptions,l.value)<l.maskOptions.mask.length&&l.setCursorToEnd();else{var fe=w(l.maskOptions,Q),he=w(l.maskOptions,fe),$e=_(l.maskOptions,he),Ve=I(l.maskOptions,$e),me={start:Ve,end:Ve};if(R(x)){var ke=x({value:he,selection:me},{value:l.value,selection:null},null,l.getBeforeMaskedValueChangeConfig());he=ke.value,me=ke.selection}var He=he!==l.getInputValue();He&&l.setInputValue(he),He&&R(l.props.onChange)&&l.props.onChange(P),l.setSelection(me.start,me.end)}l.runSaveSelectionLoop()}R(l.props.onFocus)&&l.props.onFocus(P)},l.onBlur=function(P){var x=l.props.beforeMaskedValueChange,q=l.maskOptions.mask;if(l.stopSaveSelectionLoop(),l.focused=!1,q&&!l.props.alwaysShowMask&&$(l.maskOptions,l.value)){var V="";R(x)&&(V=x({value:V,selection:null},{value:l.value,selection:l.previousSelection},null,l.getBeforeMaskedValueChangeConfig()).value);var Q=V!==l.getInputValue();Q&&l.setInputValue(V),Q&&R(l.props.onChange)&&l.props.onChange(P)}R(l.props.onBlur)&&l.props.onBlur(P)},l.onMouseDown=function(P){if(!l.focused&&document.addEventListener){l.mouseDownX=P.clientX,l.mouseDownY=P.clientY,l.mouseDownTime=new Date().getTime();var x=function q(V){if(document.removeEventListener("mouseup",q),l.focused){var Q=Math.abs(V.clientX-l.mouseDownX),fe=Math.abs(V.clientY-l.mouseDownY),he=Math.max(Q,fe),$e=new Date().getTime()-l.mouseDownTime;(he<=10&&$e<=200||he<=5&&$e<=300)&&l.setCursorToEnd()}};document.addEventListener("mouseup",x)}R(l.props.onMouseDown)&&l.props.onMouseDown(P)},l.onPaste=function(P){R(l.props.onPaste)&&l.props.onPaste(P),P.defaultPrevented||(l.beforePasteState={value:l.getInputValue(),selection:l.getSelection()},l.setInputValue(""))},l.handleRef=function(P){l.props.children==null&&R(l.props.inputRef)&&l.props.inputRef(P)};var M=f.mask,Y=f.maskChar,te=f.formatChars,E=f.alwaysShowMask,L=f.beforeMaskedValueChange,N=f.defaultValue,re=f.value;l.maskOptions=y(M,Y,te),N==null&&(N=""),re==null&&(re=N);var z=B(re);if(l.maskOptions.mask&&(E||z)&&(z=w(l.maskOptions,z),R(L))){var ie=f.value;f.value==null&&(ie=N),z=L({value:z,selection:null},{value:ie=B(ie),selection:null},null,l.getBeforeMaskedValueChangeConfig()).value}return l.value=z,l}o(v,p);var D=v.prototype;return D.componentDidMount=function(){this.mounted=!0,this.getInputDOMNode()&&(this.isWindowsPhoneBrowser=C(),this.maskOptions.mask&&this.getInputValue()!==this.value&&this.setInputValue(this.value))},D.componentDidUpdate=function(){var f=this.previousSelection,l=this.props,M=l.beforeMaskedValueChange,Y=l.alwaysShowMask,te=l.mask,E=l.maskChar,L=l.formatChars,N=this.maskOptions,re=Y||this.isFocused(),z=this.props.value!=null,ie=z?B(this.props.value):this.value,P=f?f.start:null;if(this.maskOptions=y(te,E,L),this.maskOptions.mask){!N.mask&&this.isFocused()&&this.runSaveSelectionLoop();var x=this.maskOptions.mask&&this.maskOptions.mask!==N.mask;if(N.mask||z||(ie=this.getInputValue()),(x||this.maskOptions.mask&&(ie||re))&&(ie=w(this.maskOptions,ie)),x){var q=_(this.maskOptions,ie);(P===null||q<P)&&(P=k(this.maskOptions,ie)?q:I(this.maskOptions,q))}!this.maskOptions.mask||!$(this.maskOptions,ie)||re||z&&this.props.value||(ie="");var V={start:P,end:P};if(R(M)){var Q=M({value:ie,selection:V},{value:this.value,selection:this.previousSelection},null,this.getBeforeMaskedValueChangeConfig());ie=Q.value,V=Q.selection}this.value=ie;var fe=this.getInputValue()!==this.value;fe?(this.setInputValue(this.value),this.forceUpdate()):x&&this.forceUpdate();var he=!1;V.start!=null&&V.end!=null&&(he=!f||f.start!==V.start||f.end!==V.end),(he||fe)&&this.setSelection(V.start,V.end)}else N.mask&&(this.stopSaveSelectionLoop(),this.forceUpdate())},D.componentWillUnmount=function(){this.mounted=!1,this.selectionDeferId!==null&&G(this.selectionDeferId),this.stopSaveSelectionLoop()},D.render=function(){var f,l=this.props,M=(l.mask,l.alwaysShowMask,l.maskChar,l.formatChars,l.inputRef,l.beforeMaskedValueChange,l.children),Y=i(l,["mask","alwaysShowMask","maskChar","formatChars","inputRef","beforeMaskedValueChange","children"]);if(M){R(M)||c(!1);var te=["onChange","onPaste","onMouseDown","onFocus","onBlur","value","disabled","readOnly"],E=e({},Y);te.forEach(function(N){return delete E[N]}),f=M(E),te.filter(function(N){return f.props[N]!=null&&f.props[N]!==Y[N]}).length&&c(!1)}else f=r.createElement("input",e({ref:this.handleRef},Y));var L={onFocus:this.onFocus,onBlur:this.onBlur};return this.maskOptions.mask&&(Y.disabled||Y.readOnly||(L.onChange=this.onChange,L.onPaste=this.onPaste,L.onMouseDown=this.onMouseDown),Y.value!=null&&(L.value=this.value)),f=r.cloneElement(f,L)},v})(r.Component);return nt=ee,nt}var pr;function Cn(){return pr||(pr=1,rt.exports=Mn()),rt.exports}var In=Cn();const Hn=Jr(In);var An=["startEnhancer","endEnhancer","error","positive","onChange","onFocus","onBlur","value","disabled","readOnly"],En=["Input"],Rn=["mask","maskChar","overrides"];function fr(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);r&&(a=a.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,a)}return n}function at(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?fr(Object(n),!0).forEach(function(a){Ln(t,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fr(Object(n)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(n,a))})}return t}function Ln(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function qe(t){"@babel/helpers - typeof";return qe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},qe(t)}function We(){return We=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},We.apply(this,arguments)}function vt(t,r){if(t==null)return{};var n=Tn(t,r),a,e;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(e=0;e<o.length;e++)a=o[e],!(r.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(t,a)&&(n[a]=t[a])}return n}function Tn(t,r){if(t==null)return{};var n={},a=Object.keys(t),e,o;for(o=0;o<a.length;o++)e=a[o],!(r.indexOf(e)>=0)&&(n[e]=t[e]);return n}var jr=O.forwardRef(function(t,r){t.startEnhancer,t.endEnhancer,t.error,t.positive;var n=t.onChange,a=t.onFocus,e=t.onBlur,o=t.value,i=t.disabled,s=t.readOnly,u=vt(t,An);return O.createElement(Hn,We({onChange:n,onFocus:a,onBlur:e,value:o,disabled:i,readOnly:s},u),function(c){return O.createElement(un,We({ref:r,onChange:n,onFocus:a,onBlur:e,value:o,disabled:i,readOnly:s},c))})});jr.displayName="MaskOverride";function Br(t){var r=t.mask,n=t.maskChar,a=t.overrides;a=a===void 0?{}:a;var e=a.Input,o=e===void 0?{}:e,i=vt(a,En),s=vt(t,Rn),u=jr,c={},h={};typeof o=="function"?u=o:qe(o)==="object"&&(u=o.component||u,c=o.props||{},h=o.style||{}),qe(c)==="object"&&(c=at(at({},c),{},{mask:c.mask||r,maskChar:c.maskChar||n}));var d=at({Input:{component:u,props:c,style:h}},i);return O.createElement(ln,We({},s,{overrides:d}))}Br.defaultProps={maskChar:" "};var Tt=Object.freeze({horizontal:"horizontal",vertical:"vertical"}),Fr=[0,1,2,3,4,5,6],xn=[0,1,2,3,4,5,6,7,8,9,10,11],le={high:"high",default:"default"},_e={startDate:"startDate",endDate:"endDate"},jn={locked:"locked"};function hr(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);r&&(a=a.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,a)}return n}function Me(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?hr(Object(n),!0).forEach(function(a){Bn(t,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):hr(Object(n)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(n,a))})}return t}function Bn(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}var xt=X("label",function(t){var r=t.$disabled,n=t.$theme,a=n.colors,e=n.typography;return Me(Me({},e.font250),{},{width:"100%",color:r?a.contentSecondary:a.contentPrimary,display:"block",paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0})});xt.displayName="Label";xt.displayName="Label";var jt=X("span",function(t){var r=t.$theme.sizing;return{display:"flex",width:"100%",marginTop:r.scale300,marginRight:0,marginBottom:r.scale300,marginLeft:0}});jt.displayName="LabelContainer";jt.displayName="LabelContainer";var Bt=X("span",function(t){var r=t.$disabled,n=t.$counterError,a=t.$theme,e=a.colors,o=a.typography;return Me(Me({},o.font100),{},{flex:0,width:"100%",color:n?e.negative400:r?e.contentSecondary:e.contentPrimary})});Bt.displayName="LabelEndEnhancer";Bt.displayName="LabelEndEnhancer";var Ft=X("div",function(t){var r=t.$error,n=t.$positive,a=t.$theme,e=a.colors,o=a.sizing,i=a.typography,s=e.contentSecondary;return r?s=e.negative400:n&&(s=e.positive400),Me(Me({},i.font100),{},{color:s,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,marginTop:o.scale300,marginRight:0,marginBottom:o.scale300,marginLeft:0})});Ft.displayName="Caption";Ft.displayName="Caption";var Nt=X("div",function(t){var r=t.$theme.sizing;return{width:"100%",marginBottom:r.scale600}});Nt.displayName="ControlContainer";Nt.displayName="ControlContainer";function we(){return we=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},we.apply(this,arguments)}function Ue(t){"@babel/helpers - typeof";return Ue=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ue(t)}function Fn(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function Nn(t,r){for(var n=0;n<r.length;n++){var a=r[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function Wn(t,r,n){return r&&Nn(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Vn(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&>(t,r)}function gt(t,r){return gt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,e){return a.__proto__=e,a},gt(t,r)}function Yn(t){var r=Un();return function(){var a=Ke(t),e;if(r){var o=Ke(this).constructor;e=Reflect.construct(a,arguments,o)}else e=a.apply(this,arguments);return zn(this,e)}}function zn(t,r){if(r&&(Ue(r)==="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qn(t)}function qn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Un(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ke(t){return Ke=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ke(t)}function Kn(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function Xn(t,r,n,a){return r&&typeof r!="boolean"?typeof r=="function"?r(a):r:n&&typeof n!="boolean"?typeof n=="function"?n(a):n:t?typeof t=="function"?t(a):t:null}var mt=(function(t){Vn(n,t);var r=Yn(n);function n(){return Fn(this,n),r.apply(this,arguments)}return Wn(n,[{key:"render",value:function(){var e=this.props,o=e.overrides,i=o.Label,s=o.LabelEndEnhancer,u=o.LabelContainer,c=o.Caption,h=o.ControlContainer,d=e.label,m=e.caption,g=e.disabled,y=e.error,b=e.positive,S=e.htmlFor,$=e.children,_=e.counter,k=O.Children.only($).props,w={$disabled:!!g,$error:!!y,$positive:!!b},j=Ae(i)||xt,A=Ae(s)||Bt,T=Ae(u)||jt,F=Ae(c)||Ft,I=Ae(h)||Nt,B=Xn(m,y,b,w),H=this.props.labelEndEnhancer;if(_){var C=null,R=null,U=null;Ue(_)==="object"&&(R=_.length,C=_.maxLength,U=_.error),C=C||k.maxLength,R==null&&typeof k.value=="string"&&(R=k.value.length),R==null&&(R=0),w.$length=R,C==null?H||(H="".concat(R)):(w.$maxLength=R,H||(H="".concat(R,"/").concat(C)),R>C&&U==null&&(U=!0)),U&&(w.$error=!0,w.$counterError=!0)}return O.createElement(O.Fragment,null,d&&O.createElement(T,we({},w,Ee(u)),O.createElement(j,we({"data-baseweb":"form-control-label",htmlFor:S||k.id},w,Ee(i)),typeof d=="function"?d(w):d),!!H&&O.createElement(A,we({},w,Ee(s)),typeof H=="function"?H(w):H)),O.createElement(Zr,null,function(ve){return O.createElement(I,we({"data-baseweb":"form-control-container"},w,Ee(h)),O.Children.map($,function(oe,G){if(oe){var ee=oe.key||String(G);return O.cloneElement(oe,{key:ee,"aria-errormessage":y?ve:null,"aria-describedby":m||b?ve:null,disabled:k.disabled||g,error:typeof k.error<"u"?k.error:w.$error,positive:typeof k.positive<"u"?k.positive:w.$positive})}}),(!!m||!!y||b)&&O.createElement(F,we({"data-baseweb":"form-control-caption",id:ve},w,Ee(c)),B))}))}}]),n})(O.Component);Kn(mt,"defaultProps",{overrides:{},label:null,caption:null,disabled:!1,counter:!1});function yr(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);r&&(a=a.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,a)}return n}function vr(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?yr(Object(n),!0).forEach(function(a){Qn(t,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):yr(Object(n)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(n,a))})}return t}function Qn(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}var Jn=function(r){return xn.map(function(n){return{id:n.toString(),label:r(n)}})},Zn=function(r,n){return r.map(function(a){return n.includes(Number(a.id))?a:vr(vr({},a),{},{disabled:!0})})},Gn=function(r){var n=r.filterMonthsList,a=r.formatMonthLabel,e=Jn(a);return n&&(e=Zn(e,n)),e};function ea(t){var r=t.$range,n=r===void 0?!1:r,a=t.$disabled,e=a===void 0?!1:a,o=t.$isHighlighted,i=o===void 0?!1:o,s=t.$isHovered,u=s===void 0?!1:s,c=t.$selected,h=c===void 0?!1:c,d=t.$hasRangeSelected,m=d===void 0?!1:d,g=t.$startDate,y=g===void 0?!1:g,b=t.$endDate,S=b===void 0?!1:b,$=t.$pseudoSelected,_=$===void 0?!1:$,k=t.$hasRangeHighlighted,w=k===void 0?!1:k,j=t.$pseudoHighlighted,A=j===void 0?!1:j,T=t.$hasRangeOnRight,F=T===void 0?!1:T,I=t.$startOfMonth,B=I===void 0?!1:I,H=t.$endOfMonth,C=H===void 0?!1:H,R=t.$outsideMonth,U=R===void 0?!1:R;return"".concat(+n).concat(+e).concat(+(i||u)).concat(+h).concat(+m).concat(+y).concat(+S).concat(+_).concat(+w).concat(+A).concat(+(w&&!A&&F)).concat(+(w&&!A&&!F)).concat(+B).concat(+C).concat(+U)}function ta(t,r){return oa(t)||aa(t,r)||na(t,r)||ra()}function ra(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4
4
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function na(t,r){if(t){if(typeof t=="string")return gr(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gr(t,r)}}function gr(t,r){(r==null||r>t.length)&&(r=t.length);for(var n=0,a=new Array(r);n<r;n++)a[n]=t[n];return a}function aa(t,r){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var a=[],e=!0,o=!1,i,s;try{for(n=n.call(t);!(e=(i=n.next()).done)&&(a.push(i.value),!(r&&a.length===r));e=!0);}catch(u){o=!0,s=u}finally{try{!e&&n.return!=null&&n.return()}finally{if(o)throw s}}return a}}function oa(t){if(Array.isArray(t))return t}function mr(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);r&&(a=a.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,a)}return n}function ne(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?mr(Object(n),!0).forEach(function(a){Be(t,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mr(Object(n)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(n,a))})}return t}function Be(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}var Wt=X("div",function(t){var r=t.$separateRangeInputs;return ne({width:"100%"},r?{display:"flex",justifyContent:"center"}:{})});Wt.displayName="StyledInputWrapper";Wt.displayName="StyledInputWrapper";var Vt=X("div",function(t){var r=t.$theme;return ne(ne({},r.typography.LabelMedium),{},{marginBottom:r.sizing.scale300})});Vt.displayName="StyledInputLabel";Vt.displayName="StyledInputLabel";var Yt=X("div",function(t){var r=t.$theme;return{width:"100%",marginRight:r.sizing.scale300}});Yt.displayName="StyledStartDate";Yt.displayName="StyledStartDate";var zt=X("div",function(t){return t.$theme,{width:"100%"}});zt.displayName="StyledEndDate";zt.displayName="StyledEndDate";var qt=X("div",function(t){var r=t.$theme,n=r.typography,a=r.colors,e=r.borders;return ne(ne({},n.font200),{},{color:a.calendarForeground,backgroundColor:a.calendarBackground,textAlign:"center",borderTopLeftRadius:e.surfaceBorderRadius,borderTopRightRadius:e.surfaceBorderRadius,borderBottomRightRadius:e.surfaceBorderRadius,borderBottomLeftRadius:e.surfaceBorderRadius,display:"inline-block"})});qt.displayName="StyledRoot";qt.displayName="StyledRoot";var Ut=X("div",function(t){var r=t.$orientation;return{display:"flex",flexDirection:r===Tt.vertical?"column":"row"}});Ut.displayName="StyledMonthContainer";Ut.displayName="StyledMonthContainer";var Kt=X("div",function(t){var r=t.$theme.sizing,n=t.$density;return{paddingTop:r.scale300,paddingBottom:n===le.high?r.scale400:r.scale300,paddingLeft:r.scale500,paddingRight:r.scale500}});Kt.displayName="StyledCalendarContainer";Kt.displayName="StyledCalendarContainer";var Xe=X("div",function(t){var r=t.$theme,n=r.direction==="rtl"?"right":"left";return{marginBottom:r.sizing.scale600,paddingLeft:r.sizing.scale600,paddingRight:r.sizing.scale600,textAlign:n}});Xe.displayName="StyledSelectorContainer";Xe.displayName="StyledSelectorContainer";var Xt=X("div",function(t){var r=t.$theme,n=r.typography,a=r.borders,e=r.colors,o=r.sizing,i=t.$density;return ne(ne({},i===le.high?n.LabelMedium:n.LabelLarge),{},{color:e.calendarHeaderForeground,display:"flex",justifyContent:"space-between",alignItems:"center",paddingTop:o.scale600,paddingBottom:o.scale300,paddingLeft:o.scale600,paddingRight:o.scale600,backgroundColor:e.calendarHeaderBackground,borderTopLeftRadius:a.surfaceBorderRadius,borderTopRightRadius:a.surfaceBorderRadius,borderBottomRightRadius:0,borderBottomLeftRadius:0,minHeight:i===le.high?"calc(".concat(o.scale800," + ").concat(o.scale0,")"):o.scale950})});Xt.displayName="StyledCalendarHeader";Xt.displayName="StyledCalendarHeader";var Qt=X("div",function(t){return{color:t.$theme.colors.calendarHeaderForeground,backgroundColor:t.$theme.colors.calendarHeaderBackground,whiteSpace:"nowrap"}});Qt.displayName="StyledMonthHeader";Qt.displayName="StyledMonthHeader";var Jt=X("button",function(t){var r=t.$theme,n=r.typography,a=r.colors,e=t.$isFocusVisible,o=t.$density;return ne(ne({},o===le.high?n.LabelMedium:n.LabelLarge),{},{alignItems:"center",backgroundColor:"transparent",borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,color:a.calendarHeaderForeground,cursor:"pointer",display:"flex",outline:"none",":focus":{boxShadow:e?"0 0 0 3px ".concat(a.accent):"none"}})});Jt.displayName="StyledMonthYearSelectButton";Jt.displayName="StyledMonthYearSelectButton";var Zt=X("span",function(t){var r=t.$theme.direction==="rtl"?"marginRight":"marginLeft";return Be({alignItems:"center",display:"flex"},r,t.$theme.sizing.scale500)});Zt.displayName="StyledMonthYearSelectIconContainer";Zt.displayName="StyledMonthYearSelectIconContainer";function Nr(t){var r=t.$theme,n=t.$disabled,a=t.$isFocusVisible;return{boxSizing:"border-box",display:"flex",color:n?r.colors.calendarHeaderForegroundDisabled:r.colors.calendarHeaderForeground,cursor:n?"default":"pointer",backgroundColor:"transparent",borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingTop:"0",paddingBottom:"0",paddingLeft:"0",paddingRight:"0",marginBottom:0,marginTop:0,outline:"none",":focus":n?{}:{boxShadow:a?"0 0 0 3px ".concat(r.colors.accent):"none"}}}var Gt=X("button",Nr);Gt.displayName="StyledPrevButton";Gt.displayName="StyledPrevButton";var er=X("button",Nr);er.displayName="StyledNextButton";er.displayName="StyledNextButton";var tr=X("div",function(t){return{display:"inline-block"}});tr.displayName="StyledMonth";tr.displayName="StyledMonth";var rr=X("div",function(t){var r=t.$theme.sizing;return{whiteSpace:"nowrap",display:"flex",marginBottom:r.scale0}});rr.displayName="StyledWeek";rr.displayName="StyledWeek";function K(t,r){var n,a=t.substr(0,12)+"1"+t.substr(13),e=t.substr(0,13)+"1"+t.substr(14);return n={},Be(n,t,r),Be(n,a,r),Be(n,e,r),n}function ot(t,r){var n=r.colors,a={":before":{content:null},":after":{content:null}},e=a,o={color:n.calendarForegroundDisabled,":before":{content:null},":after":{content:null}},i={color:n.calendarForegroundDisabled,":before":{borderTopStyle:"none",borderBottomStyle:"none",borderLeftStyle:"none",borderRightStyle:"none",backgroundColor:"transparent"},":after":{borderTopLeftRadius:"0%",borderTopRightRadius:"0%",borderBottomLeftRadius:"0%",borderBottomRightRadius:"0%",borderTopColor:"transparent",borderBottomColor:"transparent",borderRightColor:"transparent",borderLeftColor:"transparent"}},s={":before":{content:null}},u=1;t&&t[u]==="1"&&(e=o);var c=Object.assign({},K("001000000000000",{color:n.calendarDayForegroundPseudoSelected}),K("000100000000000",{color:n.calendarDayForegroundSelected}),K("001100000000000",{color:n.calendarDayForegroundSelectedHighlighted}),{"010000000000000":{color:n.calendarForegroundDisabled,":after":{content:null}}},{"011000000000000":{color:n.calendarForegroundDisabled,":after":{content:null}}},K("000000000000001",i),K("101000000000000",s),K("101010000000000",s),K("100100000000000",{color:n.calendarDayForegroundSelected}),K("101100000000000",{color:n.calendarDayForegroundSelectedHighlighted,":before":{content:null}}),K("100111100000000",{color:n.calendarDayForegroundSelected,":before":{content:null}}),K("101111100000000",{color:n.calendarDayForegroundSelectedHighlighted,":before":{content:null}}),K("100111000000000",{color:n.calendarDayForegroundSelected}),K("100110100000000",{color:n.calendarDayForegroundSelected,":before":{left:null,right:"50%"}}),K("100100001010000",{color:n.calendarDayForegroundSelected}),K("100100001001000",{color:n.calendarDayForegroundSelected,":before":{left:null,right:"50%"}}),K("101000001010000",{":before":{left:null,right:"50%"}}),{"101000001001000":{}},{"101000001001100":{}},{"101000001001010":{}},K("100010010000000",{color:n.calendarDayForegroundPseudoSelected,":before":{left:"0",width:"100%"},":after":{content:null}}),{"101000001100000":{color:n.calendarDayForegroundPseudoSelected,":before":{left:"0",width:"100%"},":after":{content:null}}},K("100000001100000",{color:n.calendarDayForegroundPseudoSelected,":before":{left:"0",width:"100%"},":after":{content:null}}),K("101111000000000",{color:n.calendarDayForegroundSelectedHighlighted}),K("101110100000000",{color:n.calendarDayForegroundSelectedHighlighted,":before":{left:null,right:"50%"}}),K("101010010000000",{color:n.calendarDayForegroundPseudoSelectedHighlighted,":before":{left:"0",width:"100%"}}),K("100000000000001",i),K("100000001010001",i),K("100000001001001",i),K("100010000000001",i));return c[t]||e}var nr=X("div",function(t){var r=t.$disabled,n=t.$isFocusVisible,a=t.$isHighlighted,e=t.$peekNextMonth,o=t.$pseudoSelected,i=t.$range,s=t.$selected,u=t.$outsideMonth,c=t.$outsideMonthWithinRange,h=t.$hasDateLabel,d=t.$density,m=t.$hasLockedBehavior,g=t.$selectedInput,y=t.$value,b=t.$theme,S=b.colors,$=b.typography,_=b.sizing,k=ea(t),w;h?d===le.high?w="60px":w="70px":d===le.high?w="40px":w="48px";var j=Array.isArray(y)?y:[y,null],A=ta(j,2),T=A[0],F=A[1],I=g===_e.startDate?F!==null&&typeof F<"u":T!==null&&typeof T<"u",B=i&&!(m&&!I);return ne(ne(ne({},d===le.high?$.ParagraphSmall:$.ParagraphMedium),{},{boxSizing:"border-box",position:"relative",cursor:r||!e&&u?"default":"pointer",color:S.calendarForeground,display:"inline-block",width:d===le.high?"42px":"50px",height:w,lineHeight:d===le.high?_.scale700:_.scale900,textAlign:"center",paddingTop:_.scale300,paddingBottom:_.scale300,paddingLeft:_.scale300,paddingRight:_.scale300,marginTop:0,marginBottom:0,marginLeft:0,marginRight:0,outline:"none",backgroundColor:"transparent",transform:"scale(1)"},ot(k,t.$theme)),{},{":after":ne(ne({zIndex:-1,content:'""',boxSizing:"border-box",display:"inline-block",boxShadow:n&&(!u||e)?"0 0 0 3px ".concat(S.accent):"none",backgroundColor:s?S.calendarDayBackgroundSelectedHighlighted:o&&a?S.calendarDayBackgroundPseudoSelectedHighlighted:S.calendarBackground,height:h?"100%":d===le.high?"42px":"50px",width:"100%",position:"absolute",top:h?0:"-1px",left:0,paddingTop:_.scale200,paddingBottom:_.scale200,borderLeftWidth:"2px",borderRightWidth:"2px",borderTopWidth:"2px",borderBottomWidth:"2px",borderLeftStyle:"solid",borderRightStyle:"solid",borderTopStyle:"solid",borderBottomStyle:"solid",borderTopColor:S.borderSelected,borderBottomColor:S.borderSelected,borderRightColor:S.borderSelected,borderLeftColor:S.borderSelected,borderTopLeftRadius:h?_.scale800:"100%",borderTopRightRadius:h?_.scale800:"100%",borderBottomLeftRadius:h?_.scale800:"100%",borderBottomRightRadius:h?_.scale800:"100%"},ot(k,t.$theme)[":after"]||{}),c?{content:null}:{})},B?{":before":ne(ne({zIndex:-1,content:'""',boxSizing:"border-box",display:"inline-block",backgroundColor:S.mono300,position:"absolute",height:"100%",width:"50%",top:0,left:"50%",borderTopWidth:"2px",borderBottomWidth:"2px",borderLeftWidth:"0",borderRightWidth:"0",borderTopStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderRightStyle:"solid",borderTopColor:"transparent",borderBottomColor:"transparent",borderLeftColor:"transparent",borderRightColor:"transparent"},ot(k,t.$theme)[":before"]||{}),c?{backgroundColor:S.mono300,left:"0",width:"100%",content:'""'}:{})}:{})});nr.displayName="StyledDay";nr.displayName="StyledDay";var ar=X("div",function(t){var r=t.$theme,n=r.typography,a=r.colors,e=t.$selected;return ne(ne({},n.ParagraphXSmall),{},{color:e?a.contentInverseTertiary:a.contentTertiary})});ar.displayName="StyledDayLabel";ar.displayName="StyledDayLabel";var or=X("div",function(t){var r=t.$theme,n=r.typography,a=r.colors,e=r.sizing,o=t.$density;return ne(ne({},n.LabelMedium),{},{color:a.contentTertiary,boxSizing:"border-box",position:"relative",cursor:"default",display:"inline-block",width:o===le.high?"42px":"50px",height:o===le.high?"40px":"48px",textAlign:"center",lineHeight:e.scale900,paddingTop:e.scale300,paddingBottom:e.scale300,paddingLeft:e.scale200,paddingRight:e.scale200,marginTop:0,marginBottom:0,marginLeft:0,marginRight:0,backgroundColor:"transparent"})});or.displayName="StyledWeekdayHeader";or.displayName="StyledWeekdayHeader";function bt(t){"@babel/helpers - typeof";return bt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},bt(t)}function ye(){return ye=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},ye.apply(this,arguments)}function be(t,r){return ua(t)||la(t,r)||sa(t,r)||ia()}function ia(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
streamlit/static/static/js/{useTextInputAutoExpand.DkuG1C1S.js → useTextInputAutoExpand.C9g8px1W.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ao as v,w as j,av as $,r as s,x as A,aw as F,l as N}from"./index.
|
|
1
|
+
import{ao as v,w as j,av as $,r as s,x as A,aw as F,l as N}from"./index.DBIoNOen.js";import{a as R,b as z,c as B,B as C}from"./base-input.AJ4KxBTh.js";function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?w(Object(r),!0).forEach(function(n){D(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function D(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var O=v("div",function(e){return l(l({},R(l(l({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})});O.displayName="StyledTextAreaRoot";O.displayName="StyledTextAreaRoot";var _=v("div",function(e){return z(l({$positive:!1},e))});_.displayName="StyledTextareaContainer";_.displayName="StyledTextareaContainer";var S=v("textarea",function(e){return l(l({},B(e)),{},{resize:e.$resize||"none"})});S.displayName="StyledTextarea";S.displayName="StyledTextarea";function g(e){"@babel/helpers - typeof";return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},g(e)}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},y.apply(this,arguments)}function K(e,t){return q(e)||L(e,t)||U(e,t)||M()}function M(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function U(e,t){if(e){if(typeof e=="string")return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return P(e,t)}}function P(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function L(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,u;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(c){i=!0,u=c}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw u}}return n}}function q(e){if(Array.isArray(e))return e}function V(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function W(e,t,r){return t&&G(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function X(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},m(e,t)}function Y(e){var t=J();return function(){var n=d(e),o;if(t){var i=d(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Z(this,o)}}function Z(e,t){if(t&&(g(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function f(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function J(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},d(e)}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Q=(function(e){X(r,e);var t=Y(r);function r(){var n;V(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=t.call.apply(t,[this].concat(i)),p(f(n),"state",{isFocused:n.props.autoFocus||!1}),p(f(n),"onFocus",function(u){n.setState({isFocused:!0}),n.props.onFocus(u)}),p(f(n),"onBlur",function(u){n.setState({isFocused:!1}),n.props.onBlur(u)}),n}return W(r,[{key:"render",value:function(){var o=this.props.overrides,i=o===void 0?{}:o,a=j(i.Root,O),u=K(a,2),c=u[0],h=u[1],b=$({Input:{component:S},InputContainer:{component:_}},i);return s.createElement(c,y({"data-baseweb":"textarea",$isFocused:this.state.isFocused,$isReadOnly:this.props.readOnly,$disabled:this.props.disabled,$error:this.props.error,$positive:this.props.positive,$required:this.props.required,$resize:this.props.resize},h),s.createElement(C,y({},this.props,{type:F.textarea,overrides:b,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}]),r})(s.Component);p(Q,"defaultProps",{autoFocus:!1,disabled:!1,readOnly:!1,error:!1,name:"",onBlur:function(){},onChange:function(){},onKeyDown:function(){},onKeyPress:function(){},onKeyUp:function(){},onFocus:function(){},overrides:{},placeholder:"",required:!1,rows:3,size:A.default});const k=6.5,T=1,ee=e=>{let t=0;const{current:r}=e;return r&&(r.style.height="auto",t=r.scrollHeight,r.style.height=""),t},te=(e,t,r)=>e>0&&r.current?Math.abs(e-t)>T:!1,re=(e,t)=>{if(e.current&&t.current){const{offsetHeight:r}=e.current;t.current.minHeight=r,t.current.maxHeight=r*k}},ne=(e,t,r)=>e?`${t+T}px`:r?String(r):"",oe=e=>e?`${e}px`:"",ue=({textareaRef:e,dependencies:t=[]})=>{const r=N(),n=s.useRef({minHeight:0,maxHeight:0}),[o,i]=s.useState(0),[a,u]=s.useState(!1),c=s.useCallback(()=>{i(ee(e))},[e,i]),h=s.useCallback(()=>{i(0)},[i]);s.useLayoutEffect(()=>{e.current&&re(e,n)},[e]),s.useLayoutEffect(()=>{const{minHeight:H}=n.current;u(te(o,H,e))},[o,e]),s.useLayoutEffect(()=>{c()},[e,c,...t]);const{maxHeight:b}=n.current,x=r.sizes.minElementHeight,E=ne(a,o,x),I=oe(b);return{isExtended:a,height:E,maxHeight:I,updateScrollHeight:c,clearScrollHeight:h}};export{Q as T,ue as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,ab as b}from"./index.
|
|
1
|
+
import{r as a,ab as b}from"./index.DBIoNOen.js";import{i as p}from"./inputUtils.CptNuJwn.js";function i({formId:r,maxChars:s,setDirty:n,setUiValue:e,setValueWithSource:f,additionalAction:t}){return a.useCallback(u=>{const{value:o}=u.target;s!==0&&o.length>s||(n(!0),e(o),b({formId:r})&&f({value:o,fromUi:!0}),t&&t())},[r,s,n,e,f,t])}function F(r,s,n,e,f,t=!1){return a.useCallback(u=>{const o=t?u.metaKey||u.ctrlKey:!0;!p(u)||!o||(u.preventDefault(),n&&s(),e.allowFormEnterToSubmit(r)&&e.submitForm(r,f))},[r,f,n,s,e,t])}function K(r,s,n,e){a.useEffect(()=>{e||r!==s&&n(r)},[r,s,e,n])}export{i as a,F as b,K as u};
|
streamlit/static/static/js/{useWaveformController.C5PTwL6I.js → useWaveformController.C5EtFoJE.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as Z,r as i,aR as M,ac as $,aS as O}from"./index.y5HxPwg9.js";async function q(l,e=16e3){if(!l||l.size===0)throw new Error("Invalid or empty blob provided");if(!window.AudioContext)throw new Error("AudioContext not supported in this browser");const o=new AudioContext;try{const n=await l.arrayBuffer(),r=await o.decodeAudioData(n),d=e??r.sampleRate,s=await J(r,d);return K(s,d)}finally{o.close()}}async function J(l,e){const{duration:o,numberOfChannels:n,sampleRate:r}=l,d=Math.ceil(o*e);if(!window.OfflineAudioContext)throw new Error("OfflineAudioContext not supported");const s=new OfflineAudioContext(1,d,e),p=s.createBufferSource();if(p.buffer=l,n>1){const h=s.createChannelSplitter(n),m=s.createChannelMerger(1);p.connect(h);for(let c=0;c<n;c++){const u=s.createGain();u.gain.value=1/n,h.connect(u,c),u.connect(m,0,0)}m.connect(s.destination)}else p.connect(s.destination);p.start(0);try{return await s.startRendering()}catch(h){throw new Error(`Failed to resample audio from ${r}Hz to ${e}Hz: ${h instanceof Error?h.message:String(h)}`)}}function K(l,e){const n=l.length,r=n*2+44,d=new ArrayBuffer(r),s=new DataView(d),p=l.getChannelData(0),h=(c,u)=>{for(let y=0;y<u.length;y++)s.setUint8(c+y,u.charCodeAt(y))};h(0,"RIFF"),s.setUint32(4,r-8,!0),h(8,"WAVE"),h(12,"fmt "),s.setUint32(16,16,!0),s.setUint16(20,1,!0),s.setUint16(22,1,!0),s.setUint32(24,e,!0),s.setUint32(28,e*2,!0),s.setUint16(32,2,!0),s.setUint16(34,16,!0),h(36,"data"),s.setUint32(40,n*2,!0);let m=44;for(let c=0;c<n;c++){const u=Math.max(-1,Math.min(1,p[c]));s.setInt16(m,u*32767,!0),m+=2}return new Blob([d],{type:"audio/wav"})}class W{constructor(){this.wavesurfer=null,this.currentBlobUrl=null,this.events={},this.isPlaying=!1}initialize(e){this.wavesurfer=e,this.setupEventListeners()}setupEventListeners(){this.wavesurfer&&(this.teardownEventListeners(),this.handleTimeUpdate=e=>{this.events.onTimeUpdate?.(e*1e3)},this.handlePause=()=>{this.isPlaying=!1,this.events.onPause?.()},this.handlePlay=()=>{this.isPlaying=!0,this.events.onPlay?.()},this.handleFinish=()=>{this.isPlaying=!1,this.events.onFinish?.()},this.handleReady=()=>{this.events.onReady?.()},this.handleError=e=>{const o=e instanceof Error?e:new Error(String(e));this.events.onError?.(o)},this.wavesurfer.on("timeupdate",this.handleTimeUpdate),this.wavesurfer.on("pause",this.handlePause),this.wavesurfer.on("play",this.handlePlay),this.wavesurfer.on("finish",this.handleFinish),this.wavesurfer.on("ready",this.handleReady),this.wavesurfer.on("error",this.handleError))}setEventHandlers(e){this.events=e}async load(e){if(!this.wavesurfer)throw new Error("WaveSurfer not initialized");this.cleanupPreviousUrl();let o,n=null;try{if(e instanceof Blob)n=URL.createObjectURL(e),o=n;else if(e instanceof ArrayBuffer){const r=new Blob([e]);n=URL.createObjectURL(r),o=n}else o=e;this.currentBlobUrl=n,await this.wavesurfer.load(o)}catch(r){throw this.cleanupPreviousUrl(),r}}async play(){if(!this.wavesurfer)throw new Error("WaveSurfer not initialized");await this.wavesurfer.play()}pause(){this.wavesurfer&&this.wavesurfer.pause()}getDuration(){return this.wavesurfer?this.wavesurfer.getDuration()*1e3:0}getCurrentTime(){return this.wavesurfer?this.wavesurfer.getCurrentTime()*1e3:0}getIsPlaying(){return this.isPlaying}seekToStart(){this.wavesurfer&&this.wavesurfer.seekTo(0)}cleanupPreviousUrl(){this.currentBlobUrl&&(URL.revokeObjectURL(this.currentBlobUrl),this.currentBlobUrl=null)}destroy(){this.pause(),this.cleanupPreviousUrl(),this.wavesurfer&&(this.teardownEventListeners(),this.wavesurfer.empty(),this.wavesurfer=null),this.events={},this.isPlaying=!1,this.handleTimeUpdate=void 0,this.handlePause=void 0,this.handlePlay=void 0,this.handleFinish=void 0,this.handleReady=void 0,this.handleError=void 0}teardownEventListeners(){this.wavesurfer&&(this.handleTimeUpdate&&(this.wavesurfer.un("timeupdate",this.handleTimeUpdate),this.handleTimeUpdate=void 0),this.handlePause&&(this.wavesurfer.un("pause",this.handlePause),this.handlePause=void 0),this.handlePlay&&(this.wavesurfer.un("play",this.handlePlay),this.handlePlay=void 0),this.handleFinish&&(this.wavesurfer.un("finish",this.handleFinish),this.handleFinish=void 0),this.handleReady&&(this.wavesurfer.un("ready",this.handleReady),this.handleReady=void 0),this.handleError&&(this.wavesurfer.un("error",this.handleError),this.handleError=void 0))}}function I(l){return l.name==="NotAllowedError"||l.name==="PermissionDeniedError"||l.message?.toLowerCase().includes("permission denied")}class Q{constructor(e={}){this.wavesurfer=null,this.recordPlugin=null,this.isRecording=!1,this.recordEndResolve=null,this.recordEndReject=null,this.events={},this.options=e}initialize(e,o){this.wavesurfer=e;try{const n={renderRecordedAudio:!1,mimeType:"audio/webm"};this.recordPlugin=e.registerPlugin(o.create(n)),this.setupEventListeners()}catch(n){const r=n instanceof Error?n:new Error(String(n));throw I(r)?(this.events.onPermissionDenied?.(),new Error("Microphone permission denied")):(this.events.onError?.(r),r)}}setupEventListeners(){this.recordPlugin&&(this.recordPlugin.on("record-start",()=>{this.isRecording=!0,this.events.onRecordStart?.()}),this.recordPlugin.on("record-end",e=>{this.isRecording=!1,this.events.onRecordEnd?.(e),this.recordEndResolve&&e&&e.size>0?(this.recordEndResolve(e),this.recordEndResolve=null,this.recordEndReject=null):this.recordEndReject?(this.recordEndReject(new Error("Invalid or empty recording")),this.recordEndResolve=null,this.recordEndReject=null):(this.recordEndResolve=null,this.recordEndReject=null)}),this.recordPlugin.on("record-progress",e=>{this.events.onRecordProgress?.(e)}))}setEventHandlers(e){this.events=e}async startRecording(){if(!this.recordPlugin)throw new Error("Record plugin not initialized");if(this.isRecording)return;const e=typeof this.options.sampleRate=="number"?this.options.sampleRate:void 0,o={};e!==void 0&&(o.sampleRate={ideal:e}),await this.startRecordingWithConstraints(o,e!==void 0)}async startRecordingWithConstraints(e,o){if(!this.recordPlugin)throw new Error("Record plugin not initialized");try{const n=Object.keys(e).length?e:void 0;await this.recordPlugin.startRecording(n)}catch(n){const r=n instanceof Error?n:new Error(String(n));if(I(r))throw this.events.onPermissionDenied?.(),new Error("Microphone permission denied");if(o&&(r.name==="OverconstrainedError"||r.name==="NotReadableError")){this.options.sampleRate=void 0,await this.startRecordingWithConstraints({},!1);return}throw this.events.onError?.(r),r}}async stopRecording(){if(!this.recordPlugin||!this.isRecording)throw new Error("Not currently recording");try{return await new Promise((e,o)=>{this.recordEndResolve=e,this.recordEndReject=o,this.recordPlugin?.stopRecording()})}catch(e){const o=e instanceof Error?e:new Error(String(e));throw this.events.onError?.(o),o}}cancelRecording(){this.recordPlugin&&this.isRecording&&(this.recordPlugin.stopRecording(),this.isRecording=!1,this.recordEndResolve=null,this.recordEndReject=null)}destroy(){this.cancelRecording(),this.recordPlugin&&(this.recordPlugin.destroy(),this.recordPlugin=null),this.wavesurfer=null,this.events={}}}const X=4,Y=4,ee=8,re=0,te=16e3;function se({containerRef:l,sampleRate:e,events:o,waveformPadding:n=0}){const r=Z(),[d,s]=i.useState("idle"),[p,h]=i.useState(null),[m,c]=i.useState(!1),u=i.useRef(null),y=i.useRef(null),a=i.useRef(null),f=i.useRef(o),U=i.useRef(!1),D=i.useRef(!1),E=i.useRef(new Set),P=i.useRef(!1),b=e===void 0?te:e,A=i.useCallback(()=>{E.current.clear(),c(!1),y.current&&(y.current.destroy(),y.current=null),a.current&&(a.current.destroy(),a.current=null),u.current&&(u.current.destroy(),u.current=null),U.current=!1,P.current=!1,s("idle"),h(null)},[]),x=i.useCallback(()=>{const t=Array.from(E.current);E.current.clear(),t.forEach(w=>{w.resolve()})},[]),_=i.useCallback(t=>{c(!1);const w=Array.from(E.current);E.current.clear(),w.forEach(v=>{v.reject(t)})},[]),T=i.useCallback(t=>{const w={onPlay:()=>{c(!0),f.current.onPlaybackPlay?.()},onPause:()=>{c(!1),f.current.onPlaybackPause?.()},onFinish:()=>{c(!1),f.current.onPlaybackFinish?.()},onReady:()=>{x()},onError:v=>{c(!1),_(v),f.current.onError?.(v)}};t.setEventHandlers(w)},[x,_]);i.useEffect(()=>{f.current=o,a.current&&T(a.current)},[o,T]);const S=i.useCallback(async()=>{if(!(U.current||D.current||!l.current)){D.current=!0;try{const[t,w]=await Promise.all([M(()=>import("./wavesurfer.esm.D1Sty35j.js"),[],import.meta.url),M(()=>import("./record.DytFsBUt.js"),[],import.meta.url)]),v=t.default,B=w.default,k=v.create({container:l.current,waveColor:r.colors.primary,progressColor:r.colors.bodyText,height:n>0?$(r.sizes.largestElementHeight)-2*n:"auto",barWidth:X,barGap:Y,barRadius:ee,cursorWidth:re,interact:!0});u.current=k,P.current=!1;const C=new Q({sampleRate:b});C.initialize(k,B),C.setEventHandlers({onRecordProgress:R=>{f.current.onProgressMs?.(R)},onPermissionDenied:()=>{f.current.onPermissionDenied(),s("idle")},onError:R=>{f.current.onError(R),s("idle")}}),y.current=C;const g=new W;g.initialize(k),a.current=g,T(g),U.current=!0}catch(t){const w=t instanceof Error?t:new Error(String(t));f.current.onError?.(w)}finally{D.current=!1}}},[l,r,b,T,n]);i.useEffect(()=>(S(),()=>{A()}),[A,S]),i.useEffect(()=>{const t=u.current;if(t){if(d==="recording"){t.setOptions({waveColor:r.colors.primary,progressColor:r.colors.primary});return}if(P.current){t.setOptions({interact:!0,waveColor:O(r.colors.fadedText40,r.colors.secondaryBg),progressColor:r.colors.bodyText});return}t.setOptions({waveColor:r.colors.primary,progressColor:r.colors.bodyText})}},[d,r.colors.bodyText,r.colors.fadedText40,r.colors.primary,r.colors.secondaryBg]);const F=i.useCallback(async()=>{if(d!=="recording"){if(U.current||await S(),!y.current)throw new Error("Record backend not initialized");u.current&&u.current.setOptions({waveColor:r.colors.primary,progressColor:r.colors.primary}),P.current=!1,await y.current.startRecording(),s("recording"),h(null),c(!1),f.current.onRecordStart?.()}},[d,S,r.colors.primary]),L=i.useCallback(()=>{a.current&&u.current&&(a.current.destroy(),a.current=new W,a.current.initialize(u.current),E.current.clear(),c(!1),T(a.current)),P.current=!1},[T]),z=i.useCallback(()=>{a.current?.seekToStart(),c(!1),P.current=!0,u.current&&u.current.setOptions({interact:!0,waveColor:O(r.colors.fadedText40,r.colors.secondaryBg),progressColor:r.colors.bodyText})},[r.colors.bodyText,r.colors.fadedText40,r.colors.secondaryBg]),H=i.useCallback(async()=>{if(d!=="recording")throw new Error("Not currently recording");if(!y.current||!a.current)throw new Error("Backends not initialized");try{const t=await y.current.stopRecording();h(t),await new Promise((k,C)=>{if(!a.current){C(new Error("Player not initialized"));return}const g={resolve:()=>{E.current.delete(g),k()},reject:R=>{E.current.delete(g),C(R)}};E.current.add(g),a.current.load(t).catch(R=>{E.current.delete(g),C(R instanceof Error?R:new Error(String(R)))})}),s("idle"),c(!1),z();const v={durationMs:a.current?.getDuration()??0,sampleRate:typeof b=="number"?b:null,mimeType:t.type||"audio/webm",size:t.size},B={blob:t,meta:v};return f.current.onRecordReady?.(t),B}catch(t){const w=t instanceof Error?t:new Error(String(t));return c(!1),s("idle"),f.current.onError(w),{blob:new Blob,meta:{durationMs:0,sampleRate:null,mimeType:"audio/webm",size:0}}}},[d,z,b]),j=i.useCallback(async t=>{const w=t??p;if(!w){const v=new Error("No recorded audio to approve");f.current.onError(v);return}try{const v=await q(w,b);await f.current.onApprove?.(v),h(null),s("idle")}catch(v){const B=v instanceof Error?v:new Error(String(v));f.current.onError(B)}},[p,b]),N=i.useCallback(()=>{d==="recording"&&y.current?.cancelRecording(),L(),h(null),s("idle"),c(!1),P.current=!1,f.current.onCancel?.()},[d,L]),V=i.useMemo(()=>({isPlaying:()=>a.current?.getIsPlaying()??!1,play:async()=>{if(!a.current)throw new Error("Player not initialized");await a.current.play()},pause:()=>{a.current?.pause()},load:async t=>{if(U.current||await S(),!a.current)throw new Error("Player not initialized");await a.current.load(t),z()},getCurrentTimeMs:()=>a.current?.getCurrentTime()??0,getDurationMs:()=>a.current?.getDuration()??0}),[z,S]),G=i.useCallback(t=>{f.current=t},[]);return i.useEffect(()=>()=>{A()},[A]),{state:d,isPlaybackPlaying:m,mountRef:l,start:F,stop:H,approve:j,cancel:N,destroy:A,playback:V,setEventHandlers:G}}export{se as u};
|
|
1
|
+
import{l as Z,r as i,aR as M,ac as $,aS as O}from"./index.DBIoNOen.js";async function q(l,e=16e3){if(!l||l.size===0)throw new Error("Invalid or empty blob provided");if(!window.AudioContext)throw new Error("AudioContext not supported in this browser");const o=new AudioContext;try{const n=await l.arrayBuffer(),r=await o.decodeAudioData(n),d=e??r.sampleRate,s=await J(r,d);return K(s,d)}finally{o.close()}}async function J(l,e){const{duration:o,numberOfChannels:n,sampleRate:r}=l,d=Math.ceil(o*e);if(!window.OfflineAudioContext)throw new Error("OfflineAudioContext not supported");const s=new OfflineAudioContext(1,d,e),p=s.createBufferSource();if(p.buffer=l,n>1){const h=s.createChannelSplitter(n),m=s.createChannelMerger(1);p.connect(h);for(let c=0;c<n;c++){const u=s.createGain();u.gain.value=1/n,h.connect(u,c),u.connect(m,0,0)}m.connect(s.destination)}else p.connect(s.destination);p.start(0);try{return await s.startRendering()}catch(h){throw new Error(`Failed to resample audio from ${r}Hz to ${e}Hz: ${h instanceof Error?h.message:String(h)}`)}}function K(l,e){const n=l.length,r=n*2+44,d=new ArrayBuffer(r),s=new DataView(d),p=l.getChannelData(0),h=(c,u)=>{for(let y=0;y<u.length;y++)s.setUint8(c+y,u.charCodeAt(y))};h(0,"RIFF"),s.setUint32(4,r-8,!0),h(8,"WAVE"),h(12,"fmt "),s.setUint32(16,16,!0),s.setUint16(20,1,!0),s.setUint16(22,1,!0),s.setUint32(24,e,!0),s.setUint32(28,e*2,!0),s.setUint16(32,2,!0),s.setUint16(34,16,!0),h(36,"data"),s.setUint32(40,n*2,!0);let m=44;for(let c=0;c<n;c++){const u=Math.max(-1,Math.min(1,p[c]));s.setInt16(m,u*32767,!0),m+=2}return new Blob([d],{type:"audio/wav"})}class W{constructor(){this.wavesurfer=null,this.currentBlobUrl=null,this.events={},this.isPlaying=!1}initialize(e){this.wavesurfer=e,this.setupEventListeners()}setupEventListeners(){this.wavesurfer&&(this.teardownEventListeners(),this.handleTimeUpdate=e=>{this.events.onTimeUpdate?.(e*1e3)},this.handlePause=()=>{this.isPlaying=!1,this.events.onPause?.()},this.handlePlay=()=>{this.isPlaying=!0,this.events.onPlay?.()},this.handleFinish=()=>{this.isPlaying=!1,this.events.onFinish?.()},this.handleReady=()=>{this.events.onReady?.()},this.handleError=e=>{const o=e instanceof Error?e:new Error(String(e));this.events.onError?.(o)},this.wavesurfer.on("timeupdate",this.handleTimeUpdate),this.wavesurfer.on("pause",this.handlePause),this.wavesurfer.on("play",this.handlePlay),this.wavesurfer.on("finish",this.handleFinish),this.wavesurfer.on("ready",this.handleReady),this.wavesurfer.on("error",this.handleError))}setEventHandlers(e){this.events=e}async load(e){if(!this.wavesurfer)throw new Error("WaveSurfer not initialized");this.cleanupPreviousUrl();let o,n=null;try{if(e instanceof Blob)n=URL.createObjectURL(e),o=n;else if(e instanceof ArrayBuffer){const r=new Blob([e]);n=URL.createObjectURL(r),o=n}else o=e;this.currentBlobUrl=n,await this.wavesurfer.load(o)}catch(r){throw this.cleanupPreviousUrl(),r}}async play(){if(!this.wavesurfer)throw new Error("WaveSurfer not initialized");await this.wavesurfer.play()}pause(){this.wavesurfer&&this.wavesurfer.pause()}getDuration(){return this.wavesurfer?this.wavesurfer.getDuration()*1e3:0}getCurrentTime(){return this.wavesurfer?this.wavesurfer.getCurrentTime()*1e3:0}getIsPlaying(){return this.isPlaying}seekToStart(){this.wavesurfer&&this.wavesurfer.seekTo(0)}cleanupPreviousUrl(){this.currentBlobUrl&&(URL.revokeObjectURL(this.currentBlobUrl),this.currentBlobUrl=null)}destroy(){this.pause(),this.cleanupPreviousUrl(),this.wavesurfer&&(this.teardownEventListeners(),this.wavesurfer.empty(),this.wavesurfer=null),this.events={},this.isPlaying=!1,this.handleTimeUpdate=void 0,this.handlePause=void 0,this.handlePlay=void 0,this.handleFinish=void 0,this.handleReady=void 0,this.handleError=void 0}teardownEventListeners(){this.wavesurfer&&(this.handleTimeUpdate&&(this.wavesurfer.un("timeupdate",this.handleTimeUpdate),this.handleTimeUpdate=void 0),this.handlePause&&(this.wavesurfer.un("pause",this.handlePause),this.handlePause=void 0),this.handlePlay&&(this.wavesurfer.un("play",this.handlePlay),this.handlePlay=void 0),this.handleFinish&&(this.wavesurfer.un("finish",this.handleFinish),this.handleFinish=void 0),this.handleReady&&(this.wavesurfer.un("ready",this.handleReady),this.handleReady=void 0),this.handleError&&(this.wavesurfer.un("error",this.handleError),this.handleError=void 0))}}function I(l){return l.name==="NotAllowedError"||l.name==="PermissionDeniedError"||l.message?.toLowerCase().includes("permission denied")}class Q{constructor(e={}){this.wavesurfer=null,this.recordPlugin=null,this.isRecording=!1,this.recordEndResolve=null,this.recordEndReject=null,this.events={},this.options=e}initialize(e,o){this.wavesurfer=e;try{const n={renderRecordedAudio:!1,mimeType:"audio/webm"};this.recordPlugin=e.registerPlugin(o.create(n)),this.setupEventListeners()}catch(n){const r=n instanceof Error?n:new Error(String(n));throw I(r)?(this.events.onPermissionDenied?.(),new Error("Microphone permission denied")):(this.events.onError?.(r),r)}}setupEventListeners(){this.recordPlugin&&(this.recordPlugin.on("record-start",()=>{this.isRecording=!0,this.events.onRecordStart?.()}),this.recordPlugin.on("record-end",e=>{this.isRecording=!1,this.events.onRecordEnd?.(e),this.recordEndResolve&&e&&e.size>0?(this.recordEndResolve(e),this.recordEndResolve=null,this.recordEndReject=null):this.recordEndReject?(this.recordEndReject(new Error("Invalid or empty recording")),this.recordEndResolve=null,this.recordEndReject=null):(this.recordEndResolve=null,this.recordEndReject=null)}),this.recordPlugin.on("record-progress",e=>{this.events.onRecordProgress?.(e)}))}setEventHandlers(e){this.events=e}async startRecording(){if(!this.recordPlugin)throw new Error("Record plugin not initialized");if(this.isRecording)return;const e=typeof this.options.sampleRate=="number"?this.options.sampleRate:void 0,o={};e!==void 0&&(o.sampleRate={ideal:e}),await this.startRecordingWithConstraints(o,e!==void 0)}async startRecordingWithConstraints(e,o){if(!this.recordPlugin)throw new Error("Record plugin not initialized");try{const n=Object.keys(e).length?e:void 0;await this.recordPlugin.startRecording(n)}catch(n){const r=n instanceof Error?n:new Error(String(n));if(I(r))throw this.events.onPermissionDenied?.(),new Error("Microphone permission denied");if(o&&(r.name==="OverconstrainedError"||r.name==="NotReadableError")){this.options.sampleRate=void 0,await this.startRecordingWithConstraints({},!1);return}throw this.events.onError?.(r),r}}async stopRecording(){if(!this.recordPlugin||!this.isRecording)throw new Error("Not currently recording");try{return await new Promise((e,o)=>{this.recordEndResolve=e,this.recordEndReject=o,this.recordPlugin?.stopRecording()})}catch(e){const o=e instanceof Error?e:new Error(String(e));throw this.events.onError?.(o),o}}cancelRecording(){this.recordPlugin&&this.isRecording&&(this.recordPlugin.stopRecording(),this.isRecording=!1,this.recordEndResolve=null,this.recordEndReject=null)}destroy(){this.cancelRecording(),this.recordPlugin&&(this.recordPlugin.destroy(),this.recordPlugin=null),this.wavesurfer=null,this.events={}}}const X=4,Y=4,ee=8,re=0,te=16e3;function se({containerRef:l,sampleRate:e,events:o,waveformPadding:n=0}){const r=Z(),[d,s]=i.useState("idle"),[p,h]=i.useState(null),[m,c]=i.useState(!1),u=i.useRef(null),y=i.useRef(null),a=i.useRef(null),f=i.useRef(o),U=i.useRef(!1),D=i.useRef(!1),E=i.useRef(new Set),P=i.useRef(!1),b=e===void 0?te:e,A=i.useCallback(()=>{E.current.clear(),c(!1),y.current&&(y.current.destroy(),y.current=null),a.current&&(a.current.destroy(),a.current=null),u.current&&(u.current.destroy(),u.current=null),U.current=!1,P.current=!1,s("idle"),h(null)},[]),x=i.useCallback(()=>{const t=Array.from(E.current);E.current.clear(),t.forEach(w=>{w.resolve()})},[]),_=i.useCallback(t=>{c(!1);const w=Array.from(E.current);E.current.clear(),w.forEach(v=>{v.reject(t)})},[]),T=i.useCallback(t=>{const w={onPlay:()=>{c(!0),f.current.onPlaybackPlay?.()},onPause:()=>{c(!1),f.current.onPlaybackPause?.()},onFinish:()=>{c(!1),f.current.onPlaybackFinish?.()},onReady:()=>{x()},onError:v=>{c(!1),_(v),f.current.onError?.(v)}};t.setEventHandlers(w)},[x,_]);i.useEffect(()=>{f.current=o,a.current&&T(a.current)},[o,T]);const S=i.useCallback(async()=>{if(!(U.current||D.current||!l.current)){D.current=!0;try{const[t,w]=await Promise.all([M(()=>import("./wavesurfer.esm.D1Sty35j.js"),[],import.meta.url),M(()=>import("./record.DytFsBUt.js"),[],import.meta.url)]),v=t.default,B=w.default,k=v.create({container:l.current,waveColor:r.colors.primary,progressColor:r.colors.bodyText,height:n>0?$(r.sizes.largestElementHeight)-2*n:"auto",barWidth:X,barGap:Y,barRadius:ee,cursorWidth:re,interact:!0});u.current=k,P.current=!1;const C=new Q({sampleRate:b});C.initialize(k,B),C.setEventHandlers({onRecordProgress:R=>{f.current.onProgressMs?.(R)},onPermissionDenied:()=>{f.current.onPermissionDenied(),s("idle")},onError:R=>{f.current.onError(R),s("idle")}}),y.current=C;const g=new W;g.initialize(k),a.current=g,T(g),U.current=!0}catch(t){const w=t instanceof Error?t:new Error(String(t));f.current.onError?.(w)}finally{D.current=!1}}},[l,r,b,T,n]);i.useEffect(()=>(S(),()=>{A()}),[A,S]),i.useEffect(()=>{const t=u.current;if(t){if(d==="recording"){t.setOptions({waveColor:r.colors.primary,progressColor:r.colors.primary});return}if(P.current){t.setOptions({interact:!0,waveColor:O(r.colors.fadedText40,r.colors.secondaryBg),progressColor:r.colors.bodyText});return}t.setOptions({waveColor:r.colors.primary,progressColor:r.colors.bodyText})}},[d,r.colors.bodyText,r.colors.fadedText40,r.colors.primary,r.colors.secondaryBg]);const F=i.useCallback(async()=>{if(d!=="recording"){if(U.current||await S(),!y.current)throw new Error("Record backend not initialized");u.current&&u.current.setOptions({waveColor:r.colors.primary,progressColor:r.colors.primary}),P.current=!1,await y.current.startRecording(),s("recording"),h(null),c(!1),f.current.onRecordStart?.()}},[d,S,r.colors.primary]),L=i.useCallback(()=>{a.current&&u.current&&(a.current.destroy(),a.current=new W,a.current.initialize(u.current),E.current.clear(),c(!1),T(a.current)),P.current=!1},[T]),z=i.useCallback(()=>{a.current?.seekToStart(),c(!1),P.current=!0,u.current&&u.current.setOptions({interact:!0,waveColor:O(r.colors.fadedText40,r.colors.secondaryBg),progressColor:r.colors.bodyText})},[r.colors.bodyText,r.colors.fadedText40,r.colors.secondaryBg]),H=i.useCallback(async()=>{if(d!=="recording")throw new Error("Not currently recording");if(!y.current||!a.current)throw new Error("Backends not initialized");try{const t=await y.current.stopRecording();h(t),await new Promise((k,C)=>{if(!a.current){C(new Error("Player not initialized"));return}const g={resolve:()=>{E.current.delete(g),k()},reject:R=>{E.current.delete(g),C(R)}};E.current.add(g),a.current.load(t).catch(R=>{E.current.delete(g),C(R instanceof Error?R:new Error(String(R)))})}),s("idle"),c(!1),z();const v={durationMs:a.current?.getDuration()??0,sampleRate:typeof b=="number"?b:null,mimeType:t.type||"audio/webm",size:t.size},B={blob:t,meta:v};return f.current.onRecordReady?.(t),B}catch(t){const w=t instanceof Error?t:new Error(String(t));return c(!1),s("idle"),f.current.onError(w),{blob:new Blob,meta:{durationMs:0,sampleRate:null,mimeType:"audio/webm",size:0}}}},[d,z,b]),j=i.useCallback(async t=>{const w=t??p;if(!w){const v=new Error("No recorded audio to approve");f.current.onError(v);return}try{const v=await q(w,b);await f.current.onApprove?.(v),h(null),s("idle")}catch(v){const B=v instanceof Error?v:new Error(String(v));f.current.onError(B)}},[p,b]),N=i.useCallback(()=>{d==="recording"&&y.current?.cancelRecording(),L(),h(null),s("idle"),c(!1),P.current=!1,f.current.onCancel?.()},[d,L]),V=i.useMemo(()=>({isPlaying:()=>a.current?.getIsPlaying()??!1,play:async()=>{if(!a.current)throw new Error("Player not initialized");await a.current.play()},pause:()=>{a.current?.pause()},load:async t=>{if(U.current||await S(),!a.current)throw new Error("Player not initialized");await a.current.load(t),z()},getCurrentTimeMs:()=>a.current?.getCurrentTime()??0,getDurationMs:()=>a.current?.getDuration()??0}),[z,S]),G=i.useCallback(t=>{f.current=t},[]);return i.useEffect(()=>()=>{A()},[A]),{state:d,isPlaybackPlaying:m,mountRef:l,start:F,stop:H,approve:j,cancel:N,destroy:A,playback:V,setEventHandlers:G}}export{se as u};
|
streamlit/static/static/js/{withCalculatedWidth.BREyS0pJ.js → withCalculatedWidth.CcvaXQb0.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as l,k as h,j as s,d as n}from"./index.
|
|
1
|
+
import{h as l,k as h,j as s,d as n}from"./index.DBIoNOen.js";const o=t=>{const a=e=>{const{width:i,elementRef:c}=h();return s(n,{ref:c,children:s(t,{...e,width:i})})};return a.displayName=`withCalculatedWidth(${t.displayName||t.name})`,l(a,t)};export{o as w};
|
streamlit/static/static/js/{withFullScreenWrapper.DYDiEOrW.js → withFullScreenWrapper.DP61hzLF.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,z as
|
|
1
|
+
import{r as n,z as m,be as p,bf as h,l as x,k as y,j as i,h as g}from"./index.DBIoNOen.js";const f=n.createContext(null);f.displayName="ElementFullscreenContext";const w=m("div",{target:"e5bcvgj0"})(({theme:e,isExpanded:t})=>({width:"100%",height:"100%",...t?{position:"fixed",top:0,left:0,bottom:0,right:0,background:e.colors.bgColor,zIndex:e.zIndices.fullscreenWrapper,padding:e.spacing.md,paddingTop:e.sizes.fullScreenHeaderHeight,overflow:"auto",display:"flex",alignItems:"center",justifyContent:"center"}:{}})),C=()=>{const{setFullScreen:e}=n.useContext(p),[t,s]=n.useState(!1),{fullHeight:a,fullWidth:c}=h(),l=n.useCallback(r=>{s(r),e(r)},[e]),u=n.useCallback(()=>{document.body.style.overflow="hidden",l(!0)},[l]),o=n.useCallback(()=>{document.body.style.overflow="unset",l(!1)},[l]),d=n.useCallback(r=>{r.keyCode===27&&t&&o()},[o,t]);return n.useEffect(()=>(document.addEventListener("keydown",d,!1),()=>{document.removeEventListener("keydown",d,!1)}),[d]),n.useMemo(()=>({expanded:t,zoomIn:u,zoomOut:o,fullHeight:a,fullWidth:c}),[t,u,o,a,c])},b=({children:e})=>{const t=x(),{expanded:s,fullHeight:a,fullWidth:c,zoomIn:l,zoomOut:u}=C(),{width:o,elementRef:d}=y(),r=n.useMemo(()=>({width:s?c:o,height:s?a:void 0,expanded:s,expand:l,collapse:u}),[s,a,c,o,l,u]);return i(f.Provider,{value:r,children:i(w,{ref:d,isExpanded:s,"data-testid":"stFullScreenFrame",theme:t,children:e})})};function S(e){const t=s=>i(b,{children:i(e,{...s})});return t.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,g(t,e)}export{f as E,S as w};
|
|
@@ -57,13 +57,13 @@ from streamlit.runtime.state.common import TESTING_KEY, user_key_from_element_id
|
|
|
57
57
|
if TYPE_CHECKING:
|
|
58
58
|
from pandas import DataFrame as PandasDataframe
|
|
59
59
|
|
|
60
|
-
from streamlit.proto.Arrow_pb2 import Arrow as ArrowProto
|
|
61
60
|
from streamlit.proto.Block_pb2 import Block as BlockProto
|
|
62
61
|
from streamlit.proto.Button_pb2 import Button as ButtonProto
|
|
63
62
|
from streamlit.proto.ButtonGroup_pb2 import ButtonGroup as ButtonGroupProto
|
|
64
63
|
from streamlit.proto.ChatInput_pb2 import ChatInput as ChatInputProto
|
|
65
64
|
from streamlit.proto.Code_pb2 import Code as CodeProto
|
|
66
65
|
from streamlit.proto.ColorPicker_pb2 import ColorPicker as ColorPickerProto
|
|
66
|
+
from streamlit.proto.Dataframe_pb2 import Dataframe as DataframeProto
|
|
67
67
|
from streamlit.proto.DateInput_pb2 import DateInput as DateInputProto
|
|
68
68
|
from streamlit.proto.DateTimeInput_pb2 import DateTimeInput as DateTimeInputProto
|
|
69
69
|
from streamlit.proto.Element_pb2 import Element as ElementProto
|
|
@@ -78,6 +78,7 @@ if TYPE_CHECKING:
|
|
|
78
78
|
from streamlit.proto.Radio_pb2 import Radio as RadioProto
|
|
79
79
|
from streamlit.proto.Selectbox_pb2 import Selectbox as SelectboxProto
|
|
80
80
|
from streamlit.proto.Space_pb2 import Space as SpaceProto
|
|
81
|
+
from streamlit.proto.Table_pb2 import Table as TableProto
|
|
81
82
|
from streamlit.proto.Text_pb2 import Text as TextProto
|
|
82
83
|
from streamlit.proto.TextArea_pb2 import TextArea as TextAreaProto
|
|
83
84
|
from streamlit.proto.TextInput_pb2 import TextInput as TextInputProto
|
|
@@ -495,17 +496,19 @@ class ColorPicker(Widget):
|
|
|
495
496
|
|
|
496
497
|
@dataclass(repr=False)
|
|
497
498
|
class Dataframe(Element):
|
|
498
|
-
proto:
|
|
499
|
+
proto: DataframeProto = field(repr=False)
|
|
499
500
|
|
|
500
|
-
def __init__(self, proto:
|
|
501
|
+
def __init__(self, proto: DataframeProto, root: ElementTree) -> None:
|
|
501
502
|
self.key = None
|
|
502
503
|
self.proto = proto
|
|
503
504
|
self.root = root
|
|
504
|
-
self.type = "
|
|
505
|
+
self.type = "dataframe"
|
|
505
506
|
|
|
506
507
|
@property
|
|
507
508
|
def value(self) -> PandasDataframe:
|
|
508
|
-
return dataframe_util.convert_arrow_bytes_to_pandas_df(
|
|
509
|
+
return dataframe_util.convert_arrow_bytes_to_pandas_df(
|
|
510
|
+
self.proto.arrow_data.data
|
|
511
|
+
)
|
|
509
512
|
|
|
510
513
|
|
|
511
514
|
SingleDateValue: TypeAlias = date | datetime
|
|
@@ -1262,17 +1265,19 @@ class Slider(Widget, Generic[SliderValueT]):
|
|
|
1262
1265
|
|
|
1263
1266
|
@dataclass(repr=False)
|
|
1264
1267
|
class Table(Element):
|
|
1265
|
-
proto:
|
|
1268
|
+
proto: TableProto = field(repr=False)
|
|
1266
1269
|
|
|
1267
|
-
def __init__(self, proto:
|
|
1270
|
+
def __init__(self, proto: TableProto, root: ElementTree) -> None:
|
|
1268
1271
|
self.key = None
|
|
1269
1272
|
self.proto = proto
|
|
1270
1273
|
self.root = root
|
|
1271
|
-
self.type = "
|
|
1274
|
+
self.type = "table"
|
|
1272
1275
|
|
|
1273
1276
|
@property
|
|
1274
1277
|
def value(self) -> PandasDataframe:
|
|
1275
|
-
return dataframe_util.convert_arrow_bytes_to_pandas_df(
|
|
1278
|
+
return dataframe_util.convert_arrow_bytes_to_pandas_df(
|
|
1279
|
+
self.proto.arrow_data.data
|
|
1280
|
+
)
|
|
1276
1281
|
|
|
1277
1282
|
|
|
1278
1283
|
@dataclass(repr=False)
|
|
@@ -1654,7 +1659,7 @@ class Block:
|
|
|
1654
1659
|
|
|
1655
1660
|
@property
|
|
1656
1661
|
def dataframe(self) -> ElementList[Dataframe]:
|
|
1657
|
-
return ElementList(self.get("
|
|
1662
|
+
return ElementList(self.get("dataframe")) # type: ignore
|
|
1658
1663
|
|
|
1659
1664
|
@property
|
|
1660
1665
|
def date_input(self) -> WidgetList[DateInput]:
|
|
@@ -1746,7 +1751,7 @@ class Block:
|
|
|
1746
1751
|
|
|
1747
1752
|
@property
|
|
1748
1753
|
def table(self) -> ElementList[Table]:
|
|
1749
|
-
return ElementList(self.get("
|
|
1754
|
+
return ElementList(self.get("table")) # type: ignore
|
|
1750
1755
|
|
|
1751
1756
|
@property
|
|
1752
1757
|
def tabs(self) -> Sequence[Tab]:
|
|
@@ -2112,10 +2117,10 @@ def parse_tree_from_messages(messages: list[ForwardMsg]) -> ElementTree:
|
|
|
2112
2117
|
raise ValueError(
|
|
2113
2118
|
f"Unknown alert type with format {elt.alert.format}"
|
|
2114
2119
|
)
|
|
2115
|
-
elif ty == "
|
|
2116
|
-
new_node = Dataframe(elt.
|
|
2117
|
-
elif ty == "
|
|
2118
|
-
new_node = Table(elt.
|
|
2120
|
+
elif ty == "dataframe":
|
|
2121
|
+
new_node = Dataframe(elt.dataframe, root=root)
|
|
2122
|
+
elif ty == "table":
|
|
2123
|
+
new_node = Table(elt.table, root=root)
|
|
2119
2124
|
elif ty == "button":
|
|
2120
2125
|
new_node = Button(elt.button, root=root)
|
|
2121
2126
|
elif ty == "button_group":
|
|
@@ -21,6 +21,7 @@ from typing import Final
|
|
|
21
21
|
import tornado.web
|
|
22
22
|
|
|
23
23
|
from streamlit.logger import get_logger
|
|
24
|
+
from streamlit.path_security import is_unsafe_path_pattern
|
|
24
25
|
|
|
25
26
|
_LOGGER: Final = get_logger(__name__)
|
|
26
27
|
|
|
@@ -53,6 +54,14 @@ class AppStaticFileHandler(tornado.web.StaticFileHandler):
|
|
|
53
54
|
def initialize(self, path: str, default_filename: str | None = None) -> None:
|
|
54
55
|
super().initialize(path, default_filename)
|
|
55
56
|
|
|
57
|
+
@classmethod
|
|
58
|
+
def get_absolute_path(cls, root: str, path: str) -> str:
|
|
59
|
+
# SECURITY: Validate path pattern BEFORE any filesystem operations.
|
|
60
|
+
# See is_unsafe_path_pattern() docstring for details.
|
|
61
|
+
if is_unsafe_path_pattern(path):
|
|
62
|
+
raise tornado.web.HTTPError(400, "Bad Request")
|
|
63
|
+
return super().get_absolute_path(root, path)
|
|
64
|
+
|
|
56
65
|
def validate_absolute_path(self, root: str, absolute_path: str) -> str | None:
|
|
57
66
|
full_path = os.path.abspath(absolute_path)
|
|
58
67
|
|
|
@@ -77,8 +77,8 @@ class BidiComponentRequestHandler(tornado.web.RequestHandler):
|
|
|
77
77
|
Notes
|
|
78
78
|
-----
|
|
79
79
|
This method writes directly to the response and sets appropriate HTTP
|
|
80
|
-
status codes on error (``404`` for missing components/files, ``
|
|
81
|
-
|
|
80
|
+
status codes on error (``404`` for missing components/files, ``400`` for
|
|
81
|
+
unsafe paths).
|
|
82
82
|
"""
|
|
83
83
|
parts = path.split("/")
|
|
84
84
|
component_name = parts[0]
|
|
@@ -105,8 +105,8 @@ class BidiComponentRequestHandler(tornado.web.RequestHandler):
|
|
|
105
105
|
return
|
|
106
106
|
abspath = build_safe_abspath(component_path, filename)
|
|
107
107
|
if abspath is None:
|
|
108
|
-
self.write("
|
|
109
|
-
self.set_status(
|
|
108
|
+
self.write("Bad Request")
|
|
109
|
+
self.set_status(400)
|
|
110
110
|
return
|
|
111
111
|
|
|
112
112
|
# If the resolved path is a directory, return 404 not found.
|
|
@@ -27,15 +27,18 @@ import mimetypes
|
|
|
27
27
|
import os
|
|
28
28
|
from typing import Final
|
|
29
29
|
|
|
30
|
+
from streamlit.path_security import is_unsafe_path_pattern
|
|
31
|
+
|
|
30
32
|
_OCTET_STREAM: Final[str] = "application/octet-stream"
|
|
31
33
|
|
|
32
34
|
|
|
33
35
|
def build_safe_abspath(component_root: str, relative_url_path: str) -> str | None:
|
|
34
|
-
"""Build an absolute path inside ``component_root`` if safe.
|
|
36
|
+
r"""Build an absolute path inside ``component_root`` if safe.
|
|
35
37
|
|
|
36
|
-
The function
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
The function first validates that ``relative_url_path`` does not contain
|
|
39
|
+
dangerous patterns using :func:`~streamlit.path_security.is_unsafe_path_pattern`,
|
|
40
|
+
then joins it with ``component_root`` and resolves symlinks.
|
|
41
|
+
Returns ``None`` if the path is rejected by security checks or escapes the root.
|
|
39
42
|
|
|
40
43
|
Parameters
|
|
41
44
|
----------
|
|
@@ -43,13 +46,18 @@ def build_safe_abspath(component_root: str, relative_url_path: str) -> str | Non
|
|
|
43
46
|
Absolute path to the component's root directory.
|
|
44
47
|
relative_url_path : str
|
|
45
48
|
Relative URL path from the component root to the requested file.
|
|
49
|
+
Must be a simple relative path without dangerous patterns.
|
|
46
50
|
|
|
47
51
|
Returns
|
|
48
52
|
-------
|
|
49
53
|
str or None
|
|
50
|
-
The resolved absolute path if it
|
|
51
|
-
otherwise ``None
|
|
54
|
+
The resolved absolute path if it passes all validation and stays
|
|
55
|
+
within ``component_root``; otherwise ``None``.
|
|
52
56
|
"""
|
|
57
|
+
# See is_unsafe_path_pattern() for security details.
|
|
58
|
+
if is_unsafe_path_pattern(relative_url_path):
|
|
59
|
+
return None
|
|
60
|
+
|
|
53
61
|
root_real = os.path.realpath(component_root)
|
|
54
62
|
candidate = os.path.normpath(os.path.join(root_real, relative_url_path))
|
|
55
63
|
candidate_real = os.path.realpath(candidate)
|
|
@@ -48,8 +48,8 @@ class ComponentRequestHandler(tornado.web.RequestHandler):
|
|
|
48
48
|
filename = "/".join(parts[1:])
|
|
49
49
|
abspath = build_safe_abspath(component_root, filename)
|
|
50
50
|
if abspath is None:
|
|
51
|
-
self.write("
|
|
52
|
-
self.set_status(
|
|
51
|
+
self.write("Bad Request")
|
|
52
|
+
self.set_status(400)
|
|
53
53
|
return
|
|
54
54
|
try:
|
|
55
55
|
with open(abspath, "rb") as file:
|
streamlit/web/server/routes.py
CHANGED
|
@@ -121,6 +121,20 @@ class AddSlashHandler(tornado.web.RequestHandler):
|
|
|
121
121
|
pass
|
|
122
122
|
|
|
123
123
|
|
|
124
|
+
class UnsafePathBlockHandler(tornado.web.RequestHandler):
|
|
125
|
+
"""Block requests with unsafe path patterns for security.
|
|
126
|
+
|
|
127
|
+
This is the Tornado equivalent of the Starlette PathSecurityMiddleware.
|
|
128
|
+
It blocks double-slash paths (protocol-relative URL attacks) and other
|
|
129
|
+
unsafe patterns like UNC paths and path traversal attempts.
|
|
130
|
+
"""
|
|
131
|
+
|
|
132
|
+
def prepare(self) -> None:
|
|
133
|
+
self.set_status(400)
|
|
134
|
+
self.write("Bad Request")
|
|
135
|
+
self.finish()
|
|
136
|
+
|
|
137
|
+
|
|
124
138
|
class RemoveSlashHandler(tornado.web.RequestHandler):
|
|
125
139
|
@tornado.web.removeslash
|
|
126
140
|
def get(self) -> None:
|
streamlit/web/server/server.py
CHANGED
|
@@ -49,6 +49,7 @@ from streamlit.web.server.routes import (
|
|
|
49
49
|
HostConfigHandler,
|
|
50
50
|
RemoveSlashHandler,
|
|
51
51
|
StaticFileHandler,
|
|
52
|
+
UnsafePathBlockHandler,
|
|
52
53
|
)
|
|
53
54
|
from streamlit.web.server.server_util import (
|
|
54
55
|
get_cookie_secret,
|
|
@@ -369,6 +370,9 @@ class Server:
|
|
|
369
370
|
base = config.get_option("server.baseUrlPath")
|
|
370
371
|
|
|
371
372
|
routes: list[Any] = [
|
|
373
|
+
# SECURITY: Block unsafe paths (double-slash, UNC paths, etc.)
|
|
374
|
+
# before any other handler. Matches PathSecurityMiddleware in Starlette.
|
|
375
|
+
(r"^//.*$", UnsafePathBlockHandler),
|
|
372
376
|
(
|
|
373
377
|
make_url_path_regex(base, STREAM_ENDPOINT),
|
|
374
378
|
BrowserWebSocketHandler,
|
|
@@ -140,7 +140,7 @@ def create_streamlit_middleware() -> list[Middleware]:
|
|
|
140
140
|
"""Create the Streamlit-internal middleware stack.
|
|
141
141
|
|
|
142
142
|
This function creates the middleware required for Streamlit's core functionality
|
|
143
|
-
including session management and GZip compression.
|
|
143
|
+
including path security, session management, and GZip compression.
|
|
144
144
|
|
|
145
145
|
Returns
|
|
146
146
|
-------
|
|
@@ -153,9 +153,15 @@ def create_streamlit_middleware() -> list[Middleware]:
|
|
|
153
153
|
from streamlit.web.server.starlette.starlette_gzip_middleware import (
|
|
154
154
|
MediaAwareGZipMiddleware,
|
|
155
155
|
)
|
|
156
|
+
from streamlit.web.server.starlette.starlette_path_security_middleware import (
|
|
157
|
+
PathSecurityMiddleware,
|
|
158
|
+
)
|
|
156
159
|
|
|
157
160
|
middleware: list[Middleware] = []
|
|
158
161
|
|
|
162
|
+
# FIRST: Path security middleware to block dangerous paths before any other processing.
|
|
163
|
+
middleware.append(Middleware(PathSecurityMiddleware))
|
|
164
|
+
|
|
159
165
|
# Add session middleware
|
|
160
166
|
middleware.append(
|
|
161
167
|
Middleware(
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2026)
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""Path security middleware for blocking unsafe path patterns.
|
|
16
|
+
|
|
17
|
+
This middleware implements the "Swiss Cheese" defense model - it provides
|
|
18
|
+
an additional layer of protection that catches dangerous path patterns even
|
|
19
|
+
if individual route handlers forget to validate paths. This is especially
|
|
20
|
+
important for preventing SSRF attacks via Windows UNC paths.
|
|
21
|
+
|
|
22
|
+
Defense Layers
|
|
23
|
+
--------------
|
|
24
|
+
Layer 1 (this middleware): Catch-all for any route, including future routes
|
|
25
|
+
Layer 2 (route handlers): Defense-in-depth via build_safe_abspath() and
|
|
26
|
+
explicit is_unsafe_path_pattern() checks
|
|
27
|
+
|
|
28
|
+
Each layer has potential "holes" (ways it could fail):
|
|
29
|
+
- Middleware: Could be accidentally removed, misconfigured, or bypassed
|
|
30
|
+
- Route handlers: Developer could forget to add checks to new routes
|
|
31
|
+
|
|
32
|
+
By keeping both layers, an attack only succeeds if BOTH fail simultaneously.
|
|
33
|
+
|
|
34
|
+
See Also
|
|
35
|
+
--------
|
|
36
|
+
streamlit.path_security : Core path validation functions used by this middleware
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
from __future__ import annotations
|
|
40
|
+
|
|
41
|
+
from typing import TYPE_CHECKING
|
|
42
|
+
|
|
43
|
+
from starlette.responses import Response
|
|
44
|
+
|
|
45
|
+
from streamlit.path_security import is_unsafe_path_pattern
|
|
46
|
+
|
|
47
|
+
if TYPE_CHECKING:
|
|
48
|
+
from starlette.types import ASGIApp, Receive, Scope, Send
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class PathSecurityMiddleware:
|
|
52
|
+
"""ASGI middleware that blocks requests with unsafe path patterns.
|
|
53
|
+
|
|
54
|
+
Implements Swiss Cheese defense - catches dangerous patterns even if
|
|
55
|
+
route handlers forget to validate paths. This prevents SSRF attacks
|
|
56
|
+
via Windows UNC paths and other path traversal vulnerabilities.
|
|
57
|
+
|
|
58
|
+
Parameters
|
|
59
|
+
----------
|
|
60
|
+
app
|
|
61
|
+
The ASGI application to wrap.
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
def __init__(self, app: ASGIApp) -> None:
|
|
65
|
+
self.app = app
|
|
66
|
+
|
|
67
|
+
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
|
|
68
|
+
"""Process incoming requests and block unsafe paths.
|
|
69
|
+
|
|
70
|
+
Only validates HTTP requests; WebSocket and lifespan scopes are
|
|
71
|
+
passed through without validation since they don't serve file content.
|
|
72
|
+
"""
|
|
73
|
+
# Only validate HTTP requests (skip WebSocket, lifespan)
|
|
74
|
+
if scope["type"] != "http":
|
|
75
|
+
await self.app(scope, receive, send)
|
|
76
|
+
return
|
|
77
|
+
|
|
78
|
+
path = scope.get("path", "")
|
|
79
|
+
|
|
80
|
+
# SECURITY: Check for double-slash patterns BEFORE stripping slashes.
|
|
81
|
+
# UNC paths like "//server/share" would be normalized to "server/share"
|
|
82
|
+
# by lstrip("/"), making them look safe. We must reject these early.
|
|
83
|
+
if path.startswith(("//", "\\\\")):
|
|
84
|
+
response = Response(content="Bad Request", status_code=400)
|
|
85
|
+
await response(scope, receive, send)
|
|
86
|
+
return
|
|
87
|
+
|
|
88
|
+
# Strip leading slash to get the relative path for validation
|
|
89
|
+
relative_path = path.lstrip("/")
|
|
90
|
+
|
|
91
|
+
# Check if the path contains unsafe patterns
|
|
92
|
+
if relative_path and is_unsafe_path_pattern(relative_path):
|
|
93
|
+
response = Response(content="Bad Request", status_code=400)
|
|
94
|
+
await response(scope, receive, send)
|
|
95
|
+
return
|
|
96
|
+
|
|
97
|
+
await self.app(scope, receive, send)
|
|
@@ -701,7 +701,8 @@ def create_component_routes(
|
|
|
701
701
|
# Use build_safe_abspath to properly resolve symlinks and prevent traversal
|
|
702
702
|
abspath = build_safe_abspath(component_root, filename)
|
|
703
703
|
if abspath is None:
|
|
704
|
-
|
|
704
|
+
# Return 400 for malicious paths (consistent with middleware behavior)
|
|
705
|
+
raise HTTPException(status_code=400, detail="Bad Request")
|
|
705
706
|
|
|
706
707
|
try:
|
|
707
708
|
async with await anyio.open_file(abspath, "rb") as file:
|
|
@@ -772,7 +773,8 @@ def create_bidi_component_routes(
|
|
|
772
773
|
|
|
773
774
|
abspath = build_safe_abspath(component_root, filename)
|
|
774
775
|
if abspath is None:
|
|
775
|
-
|
|
776
|
+
# Return 400 for unsafe paths (matches Tornado behavior for opacity)
|
|
777
|
+
return await _text_response("Bad Request", 400)
|
|
776
778
|
|
|
777
779
|
if await AsyncPath(abspath).is_dir():
|
|
778
780
|
return await _text_response("not found", 404)
|
|
@@ -838,7 +840,8 @@ def create_app_static_serving_routes(
|
|
|
838
840
|
relative_path = request.path_params.get("path", "")
|
|
839
841
|
safe_path = build_safe_abspath(app_static_root, relative_path)
|
|
840
842
|
if safe_path is None:
|
|
841
|
-
|
|
843
|
+
# Return 400 for malicious paths (consistent with middleware behavior)
|
|
844
|
+
raise HTTPException(status_code=400, detail="Bad Request")
|
|
842
845
|
|
|
843
846
|
async_path = AsyncPath(safe_path)
|
|
844
847
|
if not await async_path.exists() or await async_path.is_dir():
|