streamlit-nightly 1.39.1.dev20241001__py2.py3-none-any.whl → 1.39.1.dev20241003__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/commands/navigation.py +3 -0
- streamlit/config.py +1 -0
- streamlit/config_option.py +2 -0
- streamlit/elements/widgets/text_widgets.py +7 -1
- streamlit/static/asset-manifest.json +16 -16
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/1086.9d39d6cd.chunk.js +5 -0
- streamlit/static/static/js/1260.dc193a5e.chunk.js +5 -0
- streamlit/static/static/js/1780.d7a92d2b.chunk.js +1 -0
- streamlit/static/static/js/3861.5aea56b8.chunk.js +1 -0
- streamlit/static/static/js/4103.374d188d.chunk.js +1 -0
- streamlit/static/static/js/5618.34479f59.chunk.js +5 -0
- streamlit/static/static/js/5711.ad171f9d.chunk.js +1 -0
- streamlit/static/static/js/7193.7582e347.chunk.js +1 -0
- streamlit/static/static/js/7809.304e2c99.chunk.js +1 -0
- streamlit/static/static/js/8166.9447a253.chunk.js +1 -0
- streamlit/static/static/js/8237.b58252d4.chunk.js +1 -0
- streamlit/static/static/js/{8815.9d336691.chunk.js → 8815.ef4be53c.chunk.js} +1 -1
- streamlit/static/static/js/{9114.1ee3d4dd.chunk.js → 9114.c234641e.chunk.js} +1 -1
- streamlit/static/static/js/954.ce49a8cf.chunk.js +5 -0
- streamlit/static/static/js/main.57346aee.js +28 -0
- streamlit/web/bootstrap.py +4 -1
- streamlit/web/cli.py +2 -0
- streamlit/web/server/app_static_file_handler.py +1 -1
- {streamlit_nightly-1.39.1.dev20241001.dist-info → streamlit_nightly-1.39.1.dev20241003.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.39.1.dev20241001.dist-info → streamlit_nightly-1.39.1.dev20241003.dist-info}/RECORD +31 -31
- streamlit/static/static/js/1086.464de8f9.chunk.js +0 -5
- streamlit/static/static/js/1260.e6289cc2.chunk.js +0 -5
- streamlit/static/static/js/1780.48f96d0e.chunk.js +0 -1
- streamlit/static/static/js/3861.0dedcd19.chunk.js +0 -1
- streamlit/static/static/js/4103.d863052a.chunk.js +0 -1
- streamlit/static/static/js/5618.0a42d599.chunk.js +0 -5
- streamlit/static/static/js/5711.229cb7d0.chunk.js +0 -1
- streamlit/static/static/js/7193.2594a18c.chunk.js +0 -1
- streamlit/static/static/js/7809.d5f0080d.chunk.js +0 -1
- streamlit/static/static/js/8166.11abccb8.chunk.js +0 -1
- streamlit/static/static/js/8237.210a5ac4.chunk.js +0 -1
- streamlit/static/static/js/954.1da91b19.chunk.js +0 -5
- streamlit/static/static/js/main.3532f09a.js +0 -28
- /streamlit/static/static/js/{main.3532f09a.js.LICENSE.txt → main.57346aee.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.39.1.dev20241001.data → streamlit_nightly-1.39.1.dev20241003.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.39.1.dev20241001.dist-info → streamlit_nightly-1.39.1.dev20241003.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.39.1.dev20241001.dist-info → streamlit_nightly-1.39.1.dev20241003.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.39.1.dev20241001.dist-info → streamlit_nightly-1.39.1.dev20241003.dist-info}/top_level.txt +0 -0
streamlit/commands/navigation.py
CHANGED
@@ -19,6 +19,7 @@ from typing import TYPE_CHECKING, Literal
|
|
19
19
|
|
20
20
|
from typing_extensions import TypeAlias
|
21
21
|
|
22
|
+
from streamlit import config
|
22
23
|
from streamlit.errors import StreamlitAPIException
|
23
24
|
from streamlit.proto.ForwardMsg_pb2 import ForwardMsg
|
24
25
|
from streamlit.proto.Navigation_pb2 import Navigation as NavigationProto
|
@@ -225,6 +226,8 @@ def navigation(
|
|
225
226
|
msg = ForwardMsg()
|
226
227
|
if position == "hidden":
|
227
228
|
msg.navigation.position = NavigationProto.Position.HIDDEN
|
229
|
+
elif config.get_option("client.showSidebarNavigation") is False:
|
230
|
+
msg.navigation.position = NavigationProto.Position.HIDDEN
|
228
231
|
else:
|
229
232
|
msg.navigation.position = NavigationProto.Position.SIDEBAR
|
230
233
|
|
streamlit/config.py
CHANGED
@@ -128,6 +128,7 @@ def set_user_option(key: str, value: Any) -> None:
|
|
128
128
|
opt = _config_options_template[key]
|
129
129
|
except KeyError as ke:
|
130
130
|
raise StreamlitAPIException(f"Unrecognized config option: {key}") from ke
|
131
|
+
# Allow e2e tests to set any option
|
131
132
|
if opt.scriptable:
|
132
133
|
set_option(key, value)
|
133
134
|
return
|
streamlit/config_option.py
CHANGED
@@ -179,6 +179,8 @@ class ConfigOption:
|
|
179
179
|
self.where_defined = ConfigOption.DEFAULT_DEFINITION
|
180
180
|
self.type = type_
|
181
181
|
self.sensitive = sensitive
|
182
|
+
# infer multiple values if the default value is a list or tuple
|
183
|
+
self.multiple = isinstance(default_val, (list, tuple))
|
182
184
|
|
183
185
|
if self.replaced_by:
|
184
186
|
self.deprecated = True
|
@@ -436,7 +436,7 @@ class TextWidgetsMixin:
|
|
436
436
|
|
437
437
|
height : int or None
|
438
438
|
Desired height of the UI element expressed in pixels. If None, a
|
439
|
-
default height is used.
|
439
|
+
default height is used. Height must be at least 68 pixels (4.25rem).
|
440
440
|
|
441
441
|
max_chars : int or None
|
442
442
|
Maximum number of characters allowed in text area.
|
@@ -497,6 +497,12 @@ class TextWidgetsMixin:
|
|
497
497
|
height: 300px
|
498
498
|
|
499
499
|
"""
|
500
|
+
# Specified height must be at least 68 pixels (3 lines of text).
|
501
|
+
if height is not None and height < 68:
|
502
|
+
raise StreamlitAPIException(
|
503
|
+
f"Invalid height {height}px for `st.text_area` - must be at least 68 pixels."
|
504
|
+
)
|
505
|
+
|
500
506
|
ctx = get_script_run_ctx()
|
501
507
|
return self._text_area(
|
502
508
|
label=label,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"files": {
|
3
3
|
"main.css": "./static/css/main.5513bd04.css",
|
4
|
-
"main.js": "./static/js/main.
|
4
|
+
"main.js": "./static/js/main.57346aee.js",
|
5
5
|
"static/js/6679.265ca09c.chunk.js": "./static/js/6679.265ca09c.chunk.js",
|
6
6
|
"static/js/9464.7e9a3c0a.chunk.js": "./static/js/9464.7e9a3c0a.chunk.js",
|
7
7
|
"static/js/9077.e0a8db2a.chunk.js": "./static/js/9077.e0a8db2a.chunk.js",
|
@@ -9,8 +9,8 @@
|
|
9
9
|
"static/css/9943.93909c7e.chunk.css": "./static/css/9943.93909c7e.chunk.css",
|
10
10
|
"static/js/9943.6af344bb.chunk.js": "./static/js/9943.6af344bb.chunk.js",
|
11
11
|
"static/css/5711.a29b5d98.chunk.css": "./static/css/5711.a29b5d98.chunk.css",
|
12
|
-
"static/js/5711.
|
13
|
-
"static/js/3861.
|
12
|
+
"static/js/5711.ad171f9d.chunk.js": "./static/js/5711.ad171f9d.chunk.js",
|
13
|
+
"static/js/3861.5aea56b8.chunk.js": "./static/js/3861.5aea56b8.chunk.js",
|
14
14
|
"static/js/8642.58110d15.chunk.js": "./static/js/8642.58110d15.chunk.js",
|
15
15
|
"static/js/3710.b80be2b0.chunk.js": "./static/js/3710.b80be2b0.chunk.js",
|
16
16
|
"static/js/8148.f51df66c.chunk.js": "./static/js/8148.f51df66c.chunk.js",
|
@@ -18,29 +18,29 @@
|
|
18
18
|
"static/js/9923.7061d124.chunk.js": "./static/js/9923.7061d124.chunk.js",
|
19
19
|
"static/js/583.61ac7fde.chunk.js": "./static/js/583.61ac7fde.chunk.js",
|
20
20
|
"static/js/4827.f9cb5fa3.chunk.js": "./static/js/4827.f9cb5fa3.chunk.js",
|
21
|
-
"static/js/8237.
|
21
|
+
"static/js/8237.b58252d4.chunk.js": "./static/js/8237.b58252d4.chunk.js",
|
22
22
|
"static/js/5828.f8572ba4.chunk.js": "./static/js/5828.f8572ba4.chunk.js",
|
23
|
-
"static/js/1780.
|
23
|
+
"static/js/1780.d7a92d2b.chunk.js": "./static/js/1780.d7a92d2b.chunk.js",
|
24
24
|
"static/js/9060.1ec8dc2b.chunk.js": "./static/js/9060.1ec8dc2b.chunk.js",
|
25
25
|
"static/js/5625.d9509933.chunk.js": "./static/js/5625.d9509933.chunk.js",
|
26
26
|
"static/js/6141.43a8fda3.chunk.js": "./static/js/6141.43a8fda3.chunk.js",
|
27
|
-
"static/js/4103.
|
28
|
-
"static/js/1086.
|
27
|
+
"static/js/4103.374d188d.chunk.js": "./static/js/4103.374d188d.chunk.js",
|
28
|
+
"static/js/1086.9d39d6cd.chunk.js": "./static/js/1086.9d39d6cd.chunk.js",
|
29
29
|
"static/js/245.f99079b1.chunk.js": "./static/js/245.f99079b1.chunk.js",
|
30
|
-
"static/js/7193.
|
30
|
+
"static/js/7193.7582e347.chunk.js": "./static/js/7193.7582e347.chunk.js",
|
31
31
|
"static/js/6360.6d7cfa35.chunk.js": "./static/js/6360.6d7cfa35.chunk.js",
|
32
32
|
"static/js/8790.0b98f286.chunk.js": "./static/js/8790.0b98f286.chunk.js",
|
33
|
-
"static/js/8815.
|
33
|
+
"static/js/8815.ef4be53c.chunk.js": "./static/js/8815.ef4be53c.chunk.js",
|
34
34
|
"static/js/9528.746f7a0e.chunk.js": "./static/js/9528.746f7a0e.chunk.js",
|
35
|
-
"static/js/7809.
|
35
|
+
"static/js/7809.304e2c99.chunk.js": "./static/js/7809.304e2c99.chunk.js",
|
36
36
|
"static/js/6088.1164e19b.chunk.js": "./static/js/6088.1164e19b.chunk.js",
|
37
|
-
"static/js/8166.
|
38
|
-
"static/js/9114.
|
37
|
+
"static/js/8166.9447a253.chunk.js": "./static/js/8166.9447a253.chunk.js",
|
38
|
+
"static/js/9114.c234641e.chunk.js": "./static/js/9114.c234641e.chunk.js",
|
39
39
|
"static/js/5281.02b3ddc4.chunk.js": "./static/js/5281.02b3ddc4.chunk.js",
|
40
|
-
"static/js/5618.
|
41
|
-
"static/js/1260.
|
40
|
+
"static/js/5618.34479f59.chunk.js": "./static/js/5618.34479f59.chunk.js",
|
41
|
+
"static/js/1260.dc193a5e.chunk.js": "./static/js/1260.dc193a5e.chunk.js",
|
42
42
|
"static/js/3560.ce031236.chunk.js": "./static/js/3560.ce031236.chunk.js",
|
43
|
-
"static/js/954.
|
43
|
+
"static/js/954.ce49a8cf.chunk.js": "./static/js/954.ce49a8cf.chunk.js",
|
44
44
|
"static/js/3966.e0686958.chunk.js": "./static/js/3966.e0686958.chunk.js",
|
45
45
|
"static/js/8161.9b75f98a.chunk.js": "./static/js/8161.9b75f98a.chunk.js",
|
46
46
|
"static/js/6817.6adfea98.chunk.js": "./static/js/6817.6adfea98.chunk.js",
|
@@ -156,6 +156,6 @@
|
|
156
156
|
},
|
157
157
|
"entrypoints": [
|
158
158
|
"static/css/main.5513bd04.css",
|
159
|
-
"static/js/main.
|
159
|
+
"static/js/main.57346aee.js"
|
160
160
|
]
|
161
161
|
}
|
streamlit/static/index.html
CHANGED
@@ -1 +1 @@
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><link rel="shortcut icon" href="./favicon.png"/><link rel="preload" href="./static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2" as="font" type="font/woff2" crossorigin><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><link rel="shortcut icon" href="./favicon.png"/><link rel="preload" href="./static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2" as="font" type="font/woff2" crossorigin><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.57346aee.js"></script><link href="./static/css/main.5513bd04.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[1086],{68035:(e,t,r)=>{r.d(t,{A:()=>c});r(58878);var n=r(25571),o=r(78286),i=r(89653);const a=r(60667).i7`
|
2
|
+
50% {
|
3
|
+
color: rgba(0, 0, 0, 0);
|
4
|
+
}
|
5
|
+
`,s=(0,i.A)("span",{target:"edlqvik0"})((e=>{let{includeDot:t,shouldBlink:r,theme:n}=e;return{...t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:n.colors.gray,margin:`0 ${n.spacing.twoXS}`}}:{},...r?{color:n.colors.red,animationName:`${a}`,animationDuration:"0.5s",animationIterationCount:5}:{}}}),"");var l=r(90782);const c=e=>{let{dirty:t,value:r,inForm:i,maxLength:a,className:c,type:u="single",allowEnterToSubmit:d=!0}=e;const p=[],f=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];p.push((0,l.jsx)(s,{includeDot:p.length>0,shouldBlink:t,children:e},p.length))};if(d){const e=i?"submit form":"apply";if("multiline"===u){f(`Press ${(0,n.u_)()?"\u2318":"Ctrl"}+Enter to ${e}`)}else"single"===u&&f(`Press Enter to ${e}`)}return a&&("chat"!==u||t)&&f(`${r.length}/${a}`,t&&r.length>=a),(0,l.jsx)(o.tp,{"data-testid":"InputInstructions",className:c,children:p})}},1086:(e,t,r)=>{r.r(t),r.d(t,{default:()=>v});var n=r(58878),o=r(8151),i=r(68102),a=r(68622),s=n.forwardRef((function(e,t){return n.createElement(a.I,(0,i.A)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),n.createElement("rect",{width:24,height:24,fill:"none"}),n.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))}));s.displayName="Send";var l=r(94928),c=r(64611),u=r(68035),d=r(58144),p=r(89653);const f=(0,p.A)("div",{target:"e1d2x3se4"})((e=>{var t;let{theme:r,width:n}=e;return{borderRadius:r.radii.default,display:"flex",backgroundColor:null!==(t=r.colors.widgetBackgroundColor)&&void 0!==t?t:r.colors.secondaryBg,width:`${n}px`}}),""),h=(0,p.A)("div",{target:"e1d2x3se3"})((e=>{let{theme:t}=e;return{backgroundColor:t.colors.transparent,position:"relative",flexGrow:1,borderRadius:t.radii.default,display:"flex",alignItems:"center"}}),""),y=(0,p.A)("button",{target:"e1d2x3se2"})((e=>{let{theme:t,disabled:r,extended:n}=e;const o=(0,d.iq)(t),[i,a]=o?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:n?t.radii.none:t.radii.default,borderTopLeftRadius:n?t.radii.default:t.radii.none,borderBottomRightRadius:t.radii.default,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:t.lineHeights.none,margin:t.spacing.none,padding:t.spacing.sm,color:r?i:a,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:o?t.colors.gray10:t.colors.gray90},"&:hover":{backgroundColor:t.colors.primary,color:t.colors.white},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:t.colors.transparent,borderColor:t.colors.transparent,color:t.colors.gray}}}),""),g=(0,p.A)("div",{target:"e1d2x3se1"})((()=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,pointerEvents:"none"})),""),b=(0,p.A)("div",{target:"e1d2x3se0"})({name:"1lm6gnd",styles:"position:absolute;bottom:0px;right:3rem"});var m=r(90782);const v=function(e){let{width:t,element:r,widgetMgr:i,fragmentId:a}=e;const p=(0,o.u)(),[v,w]=(0,n.useState)(!1),[x,O]=(0,n.useState)(r.default),[j,C]=(0,n.useState)(0),S=(0,n.useRef)(null),A=(0,n.useRef)({minHeight:0,maxHeight:0}),k=()=>{S.current&&S.current.focus(),x&&(i.setStringTriggerValue(r,x,{fromUi:!0},a),w(!1),O(""),C(0))};(0,n.useEffect)((()=>{if(r.setValue){r.setValue=!1;const e=r.value||"";O(e),w(""!==e)}}),[r]),(0,n.useEffect)((()=>{if(S.current){const{offsetHeight:e}=S.current;A.current.minHeight=e,A.current.maxHeight=6.5*e}}),[S]);const{disabled:P,placeholder:R,maxChars:$}=r,E=(0,d.iq)(p),{minHeight:I,maxHeight:T}=A.current,B=E?p.colors.gray70:p.colors.gray80,z=!!(j>0&&S.current)&&Math.abs(j-I)>1;return(0,m.jsx)(f,{className:"stChatInput","data-testid":"stChatInput",width:t,children:(0,m.jsxs)(h,{children:[(0,m.jsx)(l.A,{inputRef:S,value:x,placeholder:R,onChange:e=>{const{value:t}=e.target,{maxChars:n}=r;0!==n&&t.length>n||(w(""!==t),O(t),C((()=>{let e=0;const{current:t}=S;if(t){const r=t.placeholder;t.placeholder="",t.style.height="auto",e=t.scrollHeight,t.placeholder=r,t.style.height=""}return e})()))},onKeyDown:e=>{const{metaKey:t,ctrlKey:r,shiftKey:n}=e;(e=>{var t;const{keyCode:r,key:n}=e;return("Enter"===n||13===r||10===r)&&!(!0===(null===(t=e.nativeEvent)||void 0===t?void 0:t.isComposing))})(e)&&!n&&!r&&!t&&(e.preventDefault(),k())},"aria-label":R,disabled:P,rows:1,overrides:{Root:{style:{minHeight:p.sizes.minElementHeight,outline:"none",backgroundColor:p.colors.transparent,borderLeftWidth:p.sizes.borderWidth,borderRightWidth:p.sizes.borderWidth,borderTopWidth:p.sizes.borderWidth,borderBottomWidth:p.sizes.borderWidth,width:`${t}px`}},InputContainer:{style:{backgroundColor:p.colors.transparent}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{lineHeight:p.lineHeights.inputWidget,backgroundColor:p.colors.transparent,"::placeholder":{color:B},height:z?`${j+1}px`:"auto",maxHeight:T?`${T}px`:"none",paddingRight:"3rem",paddingLeft:p.spacing.sm,paddingBottom:p.spacing.sm,paddingTop:p.spacing.sm}}}}),t>p.breakpoints.hideWidgetDetails&&(0,m.jsx)(b,{children:(0,m.jsx)(u.A,{dirty:v,value:x,maxLength:$,type:"chat",inForm:!1})}),(0,m.jsx)(g,{children:(0,m.jsx)(y,{onClick:k,disabled:!v||P,extended:z,"data-testid":"stChatInputSubmitButton",children:(0,m.jsx)(c.A,{content:s,size:"xl",color:"inherit"})})})]})})}},94928:(e,t,r)=>{r.d(t,{A:()=>A});var n=r(58878),o=r(35331),i=r(18648),a=r(92850),s=r(57224),l=r(81301);function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}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 p=(0,s.I4)("div",(function(e){return u(u({},(0,l.vt)(u(u({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})}));p.displayName="StyledTextAreaRoot",p.displayName="StyledTextAreaRoot";var f=(0,s.I4)("div",(function(e){return(0,l.EO)(u({$positive:!1},e))}));f.displayName="StyledTextareaContainer",f.displayName="StyledTextareaContainer";var h=(0,s.I4)("textarea",(function(e){return u(u({},(0,l.n)(e)),{},{resize:e.$resize||"none"})}));function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function g(){return g=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},g.apply(this,arguments)}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(l){s=!0,o=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(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){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},w(e,t)}function x(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=j(e);if(t){var o=j(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===y(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return O(e)}(this,r)}}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},j(e)}function C(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}h.displayName="StyledTextarea",h.displayName="StyledTextarea";var S=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}(c,e);var t,r,s,l=x(c);function c(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return C(O(e=l.call.apply(l,[this].concat(r))),"state",{isFocused:e.props.autoFocus||!1}),C(O(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t)})),C(O(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t)})),e}return t=c,(r=[{key:"render",value:function(){var e=this.props.overrides,t=void 0===e?{}:e,r=b((0,o._O)(t.Root,p),2),s=r[0],l=r[1],c=(0,o.Qp)({Input:{component:h},InputContainer:{component:f}},t);return n.createElement(s,g({"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},l),n.createElement(i.A,g({},this.props,{type:a.GT.textarea,overrides:c,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}])&&v(t.prototype,r),s&&v(t,s),Object.defineProperty(t,"prototype",{writable:!1}),c}(n.Component);C(S,"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.SK.default});const A=S}}]);
|
@@ -0,0 +1,5 @@
|
|
1
|
+
(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[1260],{68035:(t,e,r)=>{"use strict";r.d(e,{A:()=>u});r(58878);var n=r(25571),o=r(78286),i=r(89653);const s=r(60667).i7`
|
2
|
+
50% {
|
3
|
+
color: rgba(0, 0, 0, 0);
|
4
|
+
}
|
5
|
+
`,a=(0,i.A)("span",{target:"edlqvik0"})((t=>{let{includeDot:e,shouldBlink:r,theme:n}=t;return{...e?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:n.colors.gray,margin:`0 ${n.spacing.twoXS}`}}:{},...r?{color:n.colors.red,animationName:`${s}`,animationDuration:"0.5s",animationIterationCount:5}:{}}}),"");var l=r(90782);const u=t=>{let{dirty:e,value:r,inForm:i,maxLength:s,className:u,type:c="single",allowEnterToSubmit:d=!0}=t;const p=[],h=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];p.push((0,l.jsx)(a,{includeDot:p.length>0,shouldBlink:e,children:t},p.length))};if(d){const t=i?"submit form":"apply";if("multiline"===c){h(`Press ${(0,n.u_)()?"\u2318":"Ctrl"}+Enter to ${t}`)}else"single"===c&&h(`Press Enter to ${t}`)}return s&&("chat"!==c||e)&&h(`${r.length}/${s}`,e&&r.length>=s),(0,l.jsx)(o.tp,{"data-testid":"InputInstructions",className:u,children:p})}},34752:(t,e,r)=>{"use strict";r.d(e,{X:()=>s,o:()=>i});var n=r(58878),o=r(25571);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(t,e,r){(0,o.se)(this.formClearListener)&&this.lastWidgetMgr===t&&this.lastFormId===e||(this.disconnect(),(0,o._L)(e)&&(this.formClearListener=t.addFormClearedListener(e,r),this.lastWidgetMgr=t,this.lastFormId=e))}disconnect(){var t;null===(t=this.formClearListener)||void 0===t||t.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function s(t){let{element:e,widgetMgr:r,onFormCleared:i}=t;(0,n.useEffect)((()=>{if(!(0,o._L)(e.formId))return;const t=r.addFormClearedListener(e.formId,i);return()=>{t.disconnect()}}),[e,r,i])}},81260:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>v});var n=r(58878),o=r(32698),i=r.n(o),s=r(59095),a=r(8151),l=r(29669),u=r(34752),c=r(68035),d=r(70474),p=r(78286),h=r(93480),f=r(997),m=r(25571);const y=(0,r(89653).A)("div",{target:"e11y4ecf0"})((t=>{let{width:e}=t;return{position:"relative",width:e}}),"");var b=r(90782);class g extends n.PureComponent{constructor(t){var e;super(t),e=this,this.formClearHelper=new u.o,this.id=void 0,this.state={dirty:!1,focused:!1,value:this.initialValue},this.commitWidgetValue=function(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{widgetMgr:n,element:o,fragmentId:i}=e.props;n.setStringValue(o,e.state.value,t,i),r&&e.setState({dirty:!1})},this.onFormCleared=()=>{this.setState(((t,e)=>{var r;return{value:null!==(r=e.element.default)&&void 0!==r?r:null}}),(()=>this.commitWidgetValue({fromUi:!0})))},this.onBlur=()=>{this.state.dirty&&this.commitWidgetValue({fromUi:!0}),this.setState({focused:!1})},this.onFocus=()=>this.setState({focused:!0}),this.onChange=t=>{const{value:e}=t.target,{element:r}=this.props,{maxChars:n}=r;0!==n&&e.length>n||((0,m.Ml)(this.props.element)?this.setState({dirty:!0,value:e},(()=>{this.commitWidgetValue({fromUi:!0},!1)})):this.setState({dirty:!0,value:e}))},this.onKeyPress=t=>{const{element:e,widgetMgr:r,fragmentId:n}=this.props,{formId:o}=e,i=r.allowFormEnterToSubmit(o);"Enter"===t.key&&(this.state.dirty&&this.commitWidgetValue({fromUi:!0}),i&&r.submitForm(o,n))},this.id=i()("text_input_")}get initialValue(){var t;const e=this.props.widgetMgr.getStringValue(this.props.element);return null!==(t=null!==e&&void 0!==e?e:this.props.element.default)&&void 0!==t?t:null}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:t}=this.props.element;t&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:t}=this.props.element;this.props.element.setValue=!1,this.setState({value:null!==t&&void 0!==t?t:null},(()=>{this.commitWidgetValue({fromUi:!1})}))}getTypeString(){return this.props.element.type===l.ks.Type.PASSWORD?"password":"text"}render(){var t;const{dirty:e,focused:r,value:n}=this.state,{element:o,width:i,disabled:a,widgetMgr:l,theme:u}=this.props,{placeholder:g,formId:v}=o,w=(0,m.Ml)({formId:v})?l.allowFormEnterToSubmit(v):e,O=r&&i>u.breakpoints.hideWidgetDetails;return this.formClearHelper.manageFormClearListener(l,v,this.onFormCleared),(0,b.jsxs)(y,{className:"stTextInput","data-testid":"stTextInput",width:i,children:[(0,b.jsx)(d.L,{label:o.label,disabled:a,labelVisibility:(0,m.yv)(null===(t=o.labelVisibility)||void 0===t?void 0:t.value),htmlFor:this.id,children:o.help&&(0,b.jsx)(p.j,{children:(0,b.jsx)(h.A,{content:o.help,placement:f.W.TOP_RIGHT})})}),(0,b.jsx)(s.A,{value:null!==n&&void 0!==n?n:"",placeholder:g,onBlur:this.onBlur,onFocus:this.onFocus,onChange:this.onChange,onKeyPress:this.onKeyPress,"aria-label":o.label,disabled:a,id:this.id,type:this.getTypeString(),autoComplete:o.autocomplete,overrides:{Input:{style:{minWidth:0,"::placeholder":{opacity:"0.7"},lineHeight:u.lineHeights.inputWidget,paddingRight:u.spacing.sm,paddingLeft:u.spacing.sm,paddingBottom:u.spacing.sm,paddingTop:u.spacing.sm}},Root:{props:{"data-testid":"stTextInputRootElement"},style:{height:u.sizes.minElementHeight,borderLeftWidth:u.sizes.borderWidth,borderRightWidth:u.sizes.borderWidth,borderTopWidth:u.sizes.borderWidth,borderBottomWidth:u.sizes.borderWidth}}}}),O&&(0,b.jsx)(c.A,{dirty:e,value:null!==n&&void 0!==n?n:"",maxLength:o.maxChars,inForm:(0,m.Ml)({formId:v}),allowEnterToSubmit:w})]})}}const v=(0,a.b)(g)},59095:(t,e,r)=>{"use strict";r.d(e,{A:()=>E});var n=r(58878),o=r(35331),i=r(4842),s=r(18648),a=r(81301),l=r(92850);function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}var c=["Root","StartEnhancer","EndEnhancer"],d=["startEnhancer","endEnhancer","overrides"];function p(){return p=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},p.apply(this,arguments)}function h(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!==typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],s=!0,a=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);s=!0);}catch(l){a=!0,o=l}finally{try{s||null==r.return||r.return()}finally{if(a)throw o}}return i}(t,e)||function(t,e){if(!t)return;if("string"===typeof t)return f(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function m(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function y(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function b(t,e){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},b(t,e)}function g(t){var e=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=w(t);if(e){var o=w(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(t,e){if(e&&("object"===u(e)||"function"===typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return v(t)}(this,r)}}function v(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function w(t){return w=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},w(t)}function O(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var S=function(t){!function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&b(t,e)}(w,t);var e,r,u,f=g(w);function w(){var t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,w);for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return O(v(t=f.call.apply(f,[this].concat(r))),"state",{isFocused:t.props.autoFocus||!1}),O(v(t),"onFocus",(function(e){t.setState({isFocused:!0}),t.props.onFocus(e)})),O(v(t),"onBlur",(function(e){t.setState({isFocused:!1}),t.props.onBlur(e)})),t}return e=w,(r=[{key:"render",value:function(){var t=this.props,e=t.startEnhancer,r=t.endEnhancer,u=t.overrides,f=u.Root,y=u.StartEnhancer,b=u.EndEnhancer,g=m(u,c),v=m(t,d),w=h((0,o._O)(f,a.bL),2),O=w[0],S=w[1],E=h((0,o._O)(y,a.P2),2),C=E[0],P=E[1],x=h((0,o._O)(b,a.P2),2),I=x[0],W=x[1],_=(0,i.e)(this.props,this.state);return n.createElement(O,p({"data-baseweb":"input"},_,S,{$adjoined:F(e,r),$hasIconTrailing:this.props.clearable||"password"==this.props.type}),j(e)&&n.createElement(C,p({},_,P,{$position:l.vN.start}),"function"===typeof e?e(_):e),n.createElement(s.A,p({},v,{overrides:g,adjoined:F(e,r),onFocus:this.onFocus,onBlur:this.onBlur})),j(r)&&n.createElement(I,p({},_,W,{$position:l.vN.end}),"function"===typeof r?r(_):r))}}])&&y(e.prototype,r),u&&y(e,u),Object.defineProperty(e,"prototype",{writable:!1}),w}(n.Component);function F(t,e){return j(t)&&j(e)?l.fb.both:j(t)?l.fb.left:j(e)?l.fb.right:l.fb.none}function j(t){return Boolean(t||0===t)}O(S,"defaultProps",{autoComplete:"on",autoFocus:!1,disabled:!1,name:"",onBlur:function(){},onFocus:function(){},overrides:{},required:!1,size:l.SK.default,startEnhancer:null,endEnhancer:null,clearable:!1,type:"text",readOnly:!1});const E=S},32698:(t,e,r)=>{var n=r(30136),o=0;t.exports=function(t){var e=++o;return n(t)+e}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[1780],{85850:(e,t,r)=>{r.d(t,{K:()=>y,A:()=>b});r(58878);var n=r(8151),i=r(12274),o=r(63186),a=r(34914),l=r(997),s=r(36459),d=r(84720),c=r(64611),u=r(89653),g=r(58144);const p="-2.4rem",h=(0,u.A)("div",{target:"e2wxzia1"})((e=>{let{theme:t,locked:r,target:n}=e;return{padding:`${t.spacing.sm} 0 ${t.spacing.sm} ${t.spacing.sm}`,position:"absolute",top:r?p:"-1rem",right:t.spacing.none,transition:"none",...!r&&{opacity:0,"&:active, &:focus-visible, &:hover":{transition:"opacity 150ms 100ms, top 100ms 100ms",opacity:1,top:p},...n&&{[`${n}:hover &, ${n}:active &, ${n}:focus-visible &`]:{transition:"opacity 150ms 100ms, top 100ms 100ms",opacity:1,top:p}}}}}),""),f=(0,u.A)("div",{target:"e2wxzia0"})((e=>{let{theme:t}=e;return{color:(0,g.iq)(t)?t.colors.fadedText60:t.colors.bodyText,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-end",boxShadow:"1px 2px 8px rgba(0, 0, 0, 0.08)",borderRadius:t.radii.default,backgroundColor:t.colors.lightenedBg05,width:"fit-content",zIndex:t.zIndices.sidebar+1}}),"");var m=r(90782);function y(e){let{label:t,show_label:r,icon:i,onClick:o}=e;const u=(0,n.u)(),g=r?t:"";return(0,m.jsx)("div",{"data-testid":"stElementToolbarButton",children:(0,m.jsx)(l.A,{content:(0,m.jsx)(a.Ay,{source:t,allowHTML:!1,style:{fontSize:u.fontSizes.sm}}),placement:l.W.TOP,onMouseEnterDelay:1e3,inline:!0,children:(0,m.jsxs)(s.Ay,{onClick:e=>{o&&o(),e.stopPropagation()},kind:d.KX.ELEMENT_TOOLBAR,"aria-label":t,children:[i&&(0,m.jsx)(c.A,{content:i,size:"md",testid:"stElementToolbarButtonIcon"}),g&&(0,m.jsx)("span",{children:g})]})})})}const b=e=>{let{onExpand:t,onCollapse:r,isFullScreen:n,locked:a,children:l,target:s,disableFullscreenMode:d}=e;return(0,m.jsx)(h,{className:"stElementToolbar","data-testid":"stElementToolbar",locked:a||n,target:s,children:(0,m.jsxs)(f,{children:[l,t&&!d&&!n&&(0,m.jsx)(y,{label:"Fullscreen",icon:i.g,onClick:()=>t()}),r&&!d&&n&&(0,m.jsx)(y,{label:"Close fullscreen",icon:o.Q,onClick:()=>r()})]})})}},81780:(e,t,r)=>{r.r(t),r.d(t,{default:()=>pe});var n=r(58878),i=r(8151),o=r(19613),a=r(56146),l=r(95241),s=r(71034),d=r.n(s),c=r(34752),u=r(85850),g=r(25571),p=r(58144),h=r(50609),f=r.n(h),m=r(29669),y=r(67253);var b=r(93480),v=r(997),x=r(70474),C=r(35526);const w=e=>{var t;let{widgetMgr:r,id:i,key:o,defaultValue:a}=e;(0,n.useEffect)((()=>{const e=r.getElementState(i,o);(0,g.hX)(e)&&(0,g.se)(a)&&r.setElementState(i,o,a)}),[r,i,o,a]);const[l,s]=(0,n.useState)(null!==(t=r.getElementState(i,o))&&void 0!==t?t:a);return[l,(0,n.useCallback)((e=>{r.setElementState(i,o,e),s(e)}),[r,i,o])]};var j=r(89653),k=r(37888);const A=(0,j.A)("div",{target:"e12wn80j15"})(""),S=(0,j.A)("div",{target:"e12wn80j14"})((e=>{let{theme:t}=e;return{height:t.sizes.largestElementHeight,width:"100%",background:t.genericColors.secondaryBg,borderRadius:t.radii.default,marginBottom:t.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:t.spacing.xs,paddingRight:t.spacing.sm}}),""),I=(0,j.A)("div",{target:"e12wn80j13"})({name:"82a6rk",styles:"flex:1"}),U=(0,j.A)("div",{target:"e12wn80j12"})((e=>{let{show:t}=e;return{display:t?"block":"none"}}),""),R=(0,j.A)("span",{target:"e12wn80j11"})((e=>{let{theme:t,isPlayingOrRecording:r}=e;return{margin:t.spacing.sm,fontFamily:t.fonts.monospace,color:r?t.genericColors.bodyText:t.colors.fadedText60,backgroundColor:t.genericColors.secondaryBg,fontSize:t.fontSizes.sm}}),""),L=(0,j.A)("div",{target:"e12wn80j10"})((()=>({width:"100%",textAlign:"center",overflow:"hidden"})),""),E=(0,j.A)("span",{target:"e12wn80j9"})((e=>{let{theme:t}=e;return{color:t.colors.bodyText}}),""),F=(0,j.A)("a",{target:"e12wn80j8"})(""),T=(0,j.A)("div",{target:"e12wn80j7"})((e=>{let{theme:t}=e;return{height:t.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"}}),""),M=(0,j.A)("div",{target:"e12wn80j6"})((e=>{let{theme:t}=e;return{height:10,opacity:.2,width:"100%",backgroundImage:`radial-gradient(${t.colors.fadedText10} 40%, transparent 40%)`,backgroundSize:"10px 10px",backgroundRepeat:"repeat"}}),""),P=(0,j.A)("span",{target:"e12wn80j5"})((e=>{let{theme:t}=e;return{"& > button":{color:t.colors.primary,padding:t.spacing.threeXS},"& > button:hover, & > button:focus":{color:t.colors.red}}}),""),z=(0,j.A)("span",{target:"e12wn80j4"})((e=>{let{theme:t}=e;return{"& > button":{padding:t.spacing.threeXS,color:t.colors.fadedText40},"& > button:hover, & > button:focus":{color:t.colors.primary}}}),""),W=(0,j.A)("span",{target:"e12wn80j3"})((e=>{let{theme:t}=e;return{"& > button":{padding:t.spacing.threeXS,color:t.colors.fadedText60},"& > button:hover, & > button:focus":{color:t.colors.bodyText}}}),""),B=(0,j.A)("div",{target:"e12wn80j2"})((e=>{let{theme:t}=e;return{display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:t.spacing.xs,gap:t.spacing.twoXS,marginRight:t.spacing.twoXS}}),""),O=(0,j.A)("div",{target:"e12wn80j1"})((e=>{let{theme:t}=e;return{marginLeft:t.spacing.sm}}),""),X=(0,j.A)(k.x,{target:"e12wn80j0"})((e=>{let{theme:t}=e;return{fontSize:t.fontSizes.sm,width:t.sizes.spinnerSize,height:t.sizes.spinnerSize,borderWidth:t.sizes.spinnerThickness,radius:t.radii.md,justifyContents:"center",padding:t.spacing.none,margin:t.spacing.none,borderColor:t.colors.borderColor,borderTopColor:t.colors.primary,flexGrow:0,flexShrink:0}}),"");var D=r(39095),V=r(90782);const $=()=>(0,V.jsxs)(L,{children:[(0,V.jsx)(E,{children:"This app would like to use your microphone."})," ",(0,V.jsx)(F,{href:D.ML,children:"Learn how to allow access."})]}),_=()=>(0,V.jsx)(T,{children:(0,V.jsx)(M,{})}),H="00:00",N=e=>new Date(e).toLocaleTimeString(void 0,{minute:"2-digit",second:"2-digit"});var G=r(96626),K=r(34783),q=r(37789),Z=r(14757),Q=r(88685),Y=r(36459),J=r(84720),ee=r(64611);const te=e=>{let{onClick:t,disabled:r,ariaLabel:n,iconContent:i}=e;return(0,V.jsx)(Y.Ay,{kind:J.KX.BORDERLESS_ICON,onClick:t,disabled:r,"aria-label":n,fluidWidth:!0,"data-testid":"stAudioInputActionButton",children:(0,V.jsx)(ee.A,{content:i,size:"lg",color:"inherit"})})},re=e=>{let{disabled:t,stopRecording:r}=e;return(0,V.jsx)(P,{children:(0,V.jsx)(te,{onClick:r,disabled:t,ariaLabel:"Stop recording",iconContent:K.X})})},ne=e=>{let{disabled:t,isPlaying:r,onClickPlayPause:n}=e;return(0,V.jsx)(W,{children:r?(0,V.jsx)(te,{onClick:n,disabled:t,ariaLabel:"Pause",iconContent:q.v}):(0,V.jsx)(te,{onClick:n,disabled:t,ariaLabel:"Play",iconContent:Z.S})})},ie=e=>{let{disabled:t,startRecording:r}=e;return(0,V.jsx)(z,{children:(0,V.jsx)(te,{onClick:r,disabled:t,ariaLabel:"Record",iconContent:G.G})})},oe=e=>{let{onClick:t}=e;return(0,V.jsx)(W,{children:(0,V.jsx)(te,{disabled:!1,onClick:t,ariaLabel:"Reset",iconContent:Q.C})})},ae=e=>{let{disabled:t,isRecording:r,isPlaying:n,isUploading:i,isError:o,recordingUrlExists:a,startRecording:l,stopRecording:s,onClickPlayPause:d,onClear:c}=e;return o?(0,V.jsx)(B,{children:(0,V.jsx)(oe,{onClick:c})}):i?(0,V.jsx)(B,{children:(0,V.jsx)(X,{"aria-label":"Uploading"})}):(0,V.jsxs)(B,{children:[r?(0,V.jsx)(re,{disabled:t,stopRecording:s}):(0,V.jsx)(ie,{disabled:t,startRecording:l}),a&&(0,V.jsx)(ne,{disabled:t,isPlaying:n,onClickPlayPause:d})]})},le=(0,n.memo)(ae);var se=r(84996);function de(e,t,r){for(let n=0;n<r.length;n++,t+=2){const i=Math.max(-1,Math.min(1,r[n]));e.setInt16(t,i<0?32768*i:32767*i,!0)}}const ce=async function(e){const t=new window.AudioContext,r=await e.arrayBuffer();let n;try{n=await t.decodeAudioData(r)}catch(u){return void(0,se.vV)(u)}const i=n.numberOfChannels,o=n.sampleRate,a=n.length*i*2+44,l=new ArrayBuffer(a),s=new DataView(l),d={0:{type:"string",value:"RIFF"},4:{type:"uint32",value:36+2*n.length*i},8:{type:"string",value:"WAVE"},12:{type:"string",value:"fmt "},16:{type:"uint32",value:16},20:{type:"uint16",value:1},22:{type:"uint16",value:i},24:{type:"uint32",value:o},28:{type:"uint32",value:o*i*2},32:{type:"uint16",value:2*i},34:{type:"uint16",value:16},36:{type:"string",value:"data"},40:{type:"uint32",value:n.length*i*2}};Object.entries(d).forEach((e=>{let[t,{type:r,value:n}]=e;const i=parseInt(t,10);"string"===r?function(e,t,r){for(let n=0;n<r.length;n++)e.setUint8(t+n,r.charCodeAt(n))}(s,i,n):"uint32"===r?s.setUint32(i,n,!0):"uint16"===r&&s.setUint16(i,n,!0)}));for(let g=0;g<i;g++)de(s,44+g*n.length*2,n.getChannelData(g));const c=new Uint8Array(l);return new Blob([c],{type:"audio/wav"})},ue=()=>(0,V.jsx)(L,{children:(0,V.jsx)(E,{children:"An error has occurred, please try again."})}),ge=e=>{var t;let{element:r,uploadClient:s,widgetMgr:h,fragmentId:j,disabled:k}=e;const L=(0,i.u)(),E=(0,C.Z)(L),[F,T]=(0,n.useState)(null),M=n.useRef(null),[P,z]=w({widgetMgr:h,id:r.id,key:"deleteFileUrl"}),[W,B]=(0,n.useState)(null),[X,D]=(0,n.useState)([]),[G,K]=(0,n.useState)(null),[q,Z]=w({widgetMgr:h,id:r.id,key:"recordingUrl"}),[,Q]=(0,n.useState)(0),Y=()=>{Q((e=>e+1))},[J,ee]=(0,n.useState)(H),[te,re]=w({widgetMgr:h,id:r.id,key:"recordingTime",defaultValue:H}),[ne,ie]=(0,n.useState)(!1),[oe,ae]=(0,n.useState)(!1),[se,de]=(0,n.useState)(!1),[ge,pe]=(0,n.useState)(!1),[he,fe]=(0,n.useState)(!1),me=r.id,ye=r.formId,be=(0,n.useCallback)((async e=>{let t;if(pe(!0),(0,g.se)(ye)&&h.setFormsWithUploadsInProgress(new Set([ye])),t="audio/wav"===e.type?e:await ce(e),!t)return void fe(!0);const r=URL.createObjectURL(t),n=new File([t],"audio.wav",{type:t.type});Z(r),(async e=>{let{files:t,uploadClient:r,widgetMgr:n,widgetInfo:i,fragmentId:o}=e,a=[];try{a=await r.fetchFileURLs(t)}catch(c){return{successfulUploads:[],failedUploads:t.map((e=>({file:e,error:(0,y.$)(c)})))}}const l=f()(t,a),s=[],d=[];return await Promise.all(l.map((async e=>{let[t,n]=e;if(!t||!n||!n.uploadUrl||!n.fileId)return{file:t,fileUrl:n,error:new Error("No upload URL found")};try{await r.uploadFile({id:n.fileId,formId:i.formId||""},n.uploadUrl,t),s.push({fileUrl:n,file:t})}catch(c){const r=(0,y.$)(c);d.push({file:t,error:r})}}))),n.setFileUploaderStateValue(i,new m.qX({uploadedFileInfo:s.map((e=>{let{file:t,fileUrl:r}=e;return new m.HY({fileId:r.fileId,fileUrls:r,name:t.name,size:t.size})}))}),{fromUi:!0},o),{successfulUploads:s,failedUploads:d}})({files:[n],uploadClient:s,widgetMgr:h,widgetInfo:{id:me,formId:ye},fragmentId:j}).then((e=>{let{successfulUploads:t,failedUploads:r}=e;if(r.length>0)return void fe(!0);const n=t[0];n&&n.fileUrl.deleteUrl&&z(n.fileUrl.deleteUrl)})).finally((()=>{(0,g.se)(ye)&&h.setFormsWithUploadsInProgress(new Set),pe(!1)}))}),[Z,s,h,me,ye,j,z]),ve=(0,n.useCallback)((e=>{let{updateWidgetManager:t}=e;(0,g.hX)(F)||(0,g.hX)(P)||(Z(null),F.empty(),s.deleteFile(P),ee(H),re(H),z(null),t&&h.setFileUploaderStateValue(r,{},{fromUi:!0},j),ie(!1),(0,g.se)(q)&&URL.revokeObjectURL(q))}),[P,q,s,F,r,h,j,re,Z,z]);(0,n.useEffect)((()=>{if((0,g.hX)(ye))return;const e=new c.o;return e.manageFormClearListener(h,ye,(()=>{ve({updateWidgetManager:!0})})),()=>e.disconnect()}),[ye,ve,h]);const xe=(0,n.useCallback)((()=>{if(null===M.current)return;const e=o.A.create({container:M.current,waveColor:q?(0,p.au)(L.colors.fadedText40,L.genericColors.secondaryBg):L.colors.primary,progressColor:L.colors.bodyText,height:parseFloat(getComputedStyle(document.documentElement).fontSize)*parseFloat(L.sizes.largestElementHeight.replace("rem",""))-8,barWidth:4,barGap:4,barRadius:8,cursorWidth:0,url:null!==q&&void 0!==q?q:void 0});e.on("timeupdate",(e=>{ee(N(1e3*e))})),e.on("pause",(()=>{Y()}));const t=e.registerPlugin(a.A.create({scrollingWaveform:!1,renderRecordedAudio:!0}));return t.on("record-end",(async e=>{be(e)})),t.on("record-progress",(e=>{re(N(e))})),T(e),B(t),()=>{e&&e.destroy(),t&&t.destroy()}}),[be]);(0,n.useEffect)((()=>xe()),[xe]),(0,n.useEffect)((()=>{d()(E,L)||null===F||void 0===F||F.setOptions({waveColor:q?(0,p.au)(L.colors.fadedText40,L.genericColors.secondaryBg):L.colors.primary,progressColor:L.colors.bodyText})}),[L,E,q,F]);const Ce=(0,n.useCallback)((()=>{F&&(F.playPause(),ie(!0),Y())}),[F]),we=(0,n.useCallback)((async()=>{let e=G;se||(await navigator.mediaDevices.getUserMedia({audio:!0}).then((()=>a.A.getAvailableAudioDevices().then((t=>{if(D(t),t.length>0){const{deviceId:r}=t[0];K(r),e=r}})))).catch((e=>{ae(!0)})),de(!0)),W&&e&&F&&(F.setOptions({waveColor:L.colors.primary}),q&&ve({updateWidgetManager:!1}),W.startRecording({deviceId:e}).then((()=>{Y()})))}),[G,W,L,F,q,ve,se]),je=(0,n.useCallback)((()=>{W&&(W.stopRecording(),null===F||void 0===F||F.setOptions({waveColor:(0,p.au)(L.colors.fadedText40,L.genericColors.secondaryBg)}))}),[W,F,L]),ke=Boolean(null===W||void 0===W?void 0:W.isRecording()),Ae=Boolean(null===F||void 0===F?void 0:F.isPlaying()),Se=ke||Ae,Ie=!ke&&!q&&!oe,Ue=oe||Ie||he,Re=k||oe;return(0,V.jsxs)(A,{className:"stAudioInput","data-testid":"stAudioInput",children:[(0,V.jsx)(x.L,{label:r.label,disabled:Re,labelVisibility:(0,g.yv)(null===(t=r.labelVisibility)||void 0===t?void 0:t.value),children:r.help&&(0,V.jsx)(O,{children:(0,V.jsx)(b.A,{content:r.help,placement:v.W.TOP})})}),(0,V.jsxs)(S,{children:[(0,V.jsx)(u.A,{isFullScreen:!1,disableFullscreenMode:!0,target:S,children:P&&(0,V.jsx)(u.K,{label:"Clear recording",icon:l.e,onClick:()=>ve({updateWidgetManager:!0}),"data-testid":"stAudioInputClearRecordingButton"})}),(0,V.jsx)(le,{isRecording:ke,isPlaying:Ae,isUploading:ge,isError:he,recordingUrlExists:Boolean(q),startRecording:we,stopRecording:je,onClickPlayPause:Ce,onClear:()=>{ve({updateWidgetManager:!1}),fe(!1)},disabled:Re}),(0,V.jsxs)(I,{children:[he&&(0,V.jsx)(ue,{}),Ie&&(0,V.jsx)(_,{}),oe&&(0,V.jsx)($,{}),(0,V.jsx)(U,{"data-testid":"stAudioInputWaveSurfer",ref:M,show:!Ue})]}),(0,V.jsx)(R,{isPlayingOrRecording:Se,"data-testid":"stAudioInputWaveformTimeCode",children:ne?J:te})]})]})},pe=(0,n.memo)(ge)},34752:(e,t,r)=>{r.d(t,{X:()=>a,o:()=>o});var n=r(58878),i=r(25571);class o{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){(0,i.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,i._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function a(e){let{element:t,widgetMgr:r,onFormCleared:o}=e;(0,n.useEffect)((()=>{if(!(0,i._L)(t.formId))return;const e=r.addFormClearedListener(t.formId,o);return()=>{e.disconnect()}}),[t,r,o])}},35526:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(58878);const i=e=>{const t=(0,n.useRef)();return(0,n.useEffect)((()=>{t.current=e}),[e]),t.current}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[3861],{53861:(e,t,o)=>{o.r(t),o.d(t,{default:()=>b});var i=o(58878),s=o(8151),r=o(59900),a=o(58144),n=o(34914),l=o(3257),d=o(75577),c=o(94426),p=o(89653);const g=(0,p.A)("button",{target:"elibz2u3"})((e=>{let{theme:t}=e;return{fontSize:t.fontSizes.sm,lineHeight:t.lineHeights.base,color:t.colors.fadedText60,backgroundColor:t.colors.transparent,border:"none",boxShadow:"none",padding:t.spacing.none,"&:hover, &:active, &:focus":{border:"none",outline:"none",boxShadow:"none"},"&:hover":{color:t.colors.primary}}}),""),u=(0,p.A)("div",{target:"elibz2u2"})((e=>{let{theme:t}=e;return{display:"flex",flexDirection:"row",gap:t.spacing.lg,"> span":{marginTop:t.spacing.twoXS}}}),""),f=(0,p.A)("div",{target:"elibz2u0"})((e=>{let{theme:t}=e;return{display:"flex",flexDirection:"column",gap:t.spacing.sm,alignItems:"start",justifyContent:"center",overflow:"hidden",minHeight:"100%",fontSize:t.fontSizes.sm,lineHeight:t.lineHeights.base}}),"");var h=o(90782);const b=(0,s.b)((function(e){let{theme:t,body:o,icon:s,width:p}=e;const b=function(e){if(e.length>104){let t=e.replace(/^(.{104}[^\s]*).*/,"$1");return t.length>104&&(t=t.substring(0,104).split(" ").slice(0,-1).join(" ")),t.trim()}return e}(o),m=o!==b,[x,w]=(0,i.useState)(!m),[y,S]=(0,i.useState)(0),v=(0,i.useCallback)((()=>{w(!x)}),[x]),T=(0,i.useMemo)((()=>function(e){const t=(0,a.iq)(e);return{Body:{props:{"data-testid":"stToast",className:"stToast"},style:{display:"flex",flexDirection:"row",gap:e.spacing.md,width:e.sizes.toastWidth,marginTop:e.spacing.sm,borderTopLeftRadius:e.radii.default,borderTopRightRadius:e.radii.default,borderBottomLeftRadius:e.radii.default,borderBottomRightRadius:e.radii.default,paddingTop:e.spacing.lg,paddingBottom:e.spacing.lg,paddingLeft:e.spacing.twoXL,paddingRight:e.spacing.twoXL,backgroundColor:t?e.colors.gray10:e.colors.gray90,color:e.colors.bodyText,boxShadow:t?"0px 4px 16px rgba(0, 0, 0, 0.16)":"0px 4px 16px rgba(0, 0, 0, 0.7)"}},CloseIcon:{style:{color:e.colors.fadedText40,width:e.fontSizes.lg,height:e.fontSizes.lg,marginRight:`calc(-1 * ${e.spacing.lg} / 2)`,":hover":{color:e.colors.bodyText}}}}}(t)),[t]),z=(0,i.useMemo)((()=>(0,h.jsxs)(u,{expanded:x,children:[s&&(0,h.jsx)(c.$,{iconValue:s,size:"xl",testid:"stToastDynamicIcon"}),(0,h.jsxs)(f,{children:[(0,h.jsx)(n.Ay,{source:x?o:b,allowHTML:!1,isToast:!0}),m&&(0,h.jsx)(g,{"data-testid":"stToastViewButton",onClick:v,children:x?"view less":"view more"})]})]})),[m,x,o,s,b,v]);(0,i.useEffect)((()=>{if(t.inSidebar)return;const e=r.A.info(z,{overrides:{...T}});return S(e),()=>{r.A.update(e,{overrides:{Body:{style:{transitionDuration:0}}}}),r.A.clear(e)}}),[]),(0,i.useEffect)((()=>{r.A.update(y,{children:z,overrides:{...T}})}),[y,z,T]);const A=(0,h.jsx)(d.A,{kind:l.b.ERROR,body:"Streamlit API Error: `st.toast` cannot be called directly on the sidebar with `st.sidebar.toast`. See our `st.toast` API [docs](https://docs.streamlit.io/develop/api-reference/status/st.toast) for more information.",width:p});return(0,h.jsx)(h.Fragment,{children:t.inSidebar&&A})}))}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[4103],{3727:(e,t,s)=>{s.d(t,{A:()=>h,o:()=>c});var i=s(58878),r=s(8151),o=s(70766),a=s(35331),n=s(58144),l=s(84152),d=s(90782);let c;!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(c||(c={}));const h=function(e){let{value:t,width:s,size:h=c.SMALL,overrides:u}=e;const g=(0,r.u)(),p={xs:g.spacing.twoXS,sm:g.spacing.sm,md:g.spacing.lg,lg:g.spacing.xl,xl:g.spacing.twoXL},{activeTheme:m}=i.useContext(l.n),f=!(0,n.tl)(m),S={BarContainer:{style:{marginTop:g.spacing.none,marginBottom:g.spacing.none,marginRight:g.spacing.none,marginLeft:g.spacing.none}},Bar:{style:e=>{let{$theme:t}=e;return{width:s?s.toString():void 0,marginTop:g.spacing.none,marginBottom:g.spacing.none,marginRight:g.spacing.none,marginLeft:g.spacing.none,height:p[h],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:g.spacing.twoXS,borderTopRightRadius:g.spacing.twoXS,borderBottomLeftRadius:g.spacing.twoXS,borderBottomRightRadius:g.spacing.twoXS}}},BarProgress:{style:()=>({backgroundColor:f?g.colors.primary:g.colors.blue70,borderTopLeftRadius:g.spacing.twoXS,borderTopRightRadius:g.spacing.twoXS,borderBottomLeftRadius:g.spacing.twoXS,borderBottomRightRadius:g.spacing.twoXS})}};return(0,d.jsx)(o.A,{value:t,overrides:(0,a.Qp)(S,u)})}},54103:(e,t,s)=>{s.r(t),s.d(t,{default:()=>K});var i,r=s(58878),o=s(41766),a=s(32782),n=s(71034),l=s.n(n),d=s(29669),c=s(64611),h=s(997),u=s(93480),g=s(70474),p=s(78286),m=s(34752),f=s(84996),S=s(25571),C=s(9830),R=s(3727),b=s(89653),w=s(32735);function I(e,t){switch(e){case i.XSMALL:return{padding:`${t.spacing.twoXS} ${t.spacing.sm}`,fontSize:t.fontSizes.sm};case i.SMALL:return{padding:`${t.spacing.twoXS} ${t.spacing.md}`};case i.LARGE:return{padding:`${t.spacing.md} ${t.spacing.md}`};default:return{padding:`${t.spacing.xs} ${t.spacing.md}`}}}!function(e){e.XSMALL="xsmall",e.SMALL="small",e.MEDIUM="medium",e.LARGE="large"}(i||(i={}));const F=(0,b.A)("div",{target:"etz5kuj9"})((()=>({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"})),""),v=(0,b.A)("div",{target:"etz5kuj8"})((e=>{let{theme:t,width:s}=e;return{backgroundColor:t.colors.secondaryBg,borderRadius:`${t.radii.default} ${t.radii.default} 0 0`,width:"100%",height:9*s/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}}),""),x=(0,b.A)("p",{target:"etz5kuj7"})((e=>{let{theme:t}=e;return{marginTop:t.spacing.sm,textAlign:"center"}}),""),M=(0,b.A)("img",{target:"etz5kuj6"})((e=>{let{theme:t,opacity:s}=e;return{borderRadius:`${t.radii.default} ${t.radii.default} 0 0`,objectFit:"contain",opacity:s}}),""),y=(0,b.A)("a",{target:"etz5kuj5"})((e=>{let{theme:t}=e;return{color:t.colors.primary,display:"block",textDecoration:"none"}}),""),L=(0,b.A)("span",{target:"etz5kuj4"})((()=>({display:"flex",alignItems:"center"})),""),E=(0,b.A)("div",{target:"etz5kuj3"})((e=>{let{theme:t}=e;return{position:"absolute",top:t.spacing.lg,right:t.spacing.lg,zIndex:1,color:t.colors.fadedText40,mixBlendMode:"difference",opacity:.6}}),""),j=(0,b.A)("div",{target:"etz5kuj1"})((()=>({height:"fit-content",width:"100%",position:"absolute",bottom:0})),""),T=(0,b.A)("button",{target:"etz5kuj0"})((e=>{let{theme:t}=e;return{position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:t.colors.lightenedBg05,border:`${t.sizes.borderWidth} solid ${t.colors.borderColor}`,borderRadius:`0 0 ${t.radii.default} ${t.radii.default}`,"&:hover":{borderColor:t.colors.primary,color:t.colors.primary},"&:active":{color:t.colors.white,borderColor:t.colors.primary,backgroundColor:t.colors.primary},"&:focus:not(:active)":{borderColor:t.colors.primary,color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:t.colors.fadedText40},fontWeight:t.fontWeights.normal,padding:`${t.spacing.xs} ${t.spacing.md}`,margin:t.spacing.none,lineHeight:t.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${(0,w.No)(t.colors.primary,.5)}`},...I(i.MEDIUM,t)}}),"");var U=s(90782);const P=function(e){let{disabled:t,onClick:s,children:i,progress:r}=e;return(0,U.jsxs)(T,{disabled:t||!1,onClick:s||(()=>{}),progress:r||null,"data-testid":"stCameraInputButton",children:[i,r&&(0,U.jsx)(j,{children:(0,U.jsx)(R.A,{value:r,size:R.o.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})})]})};var A=s(25005),k=s(36459),X=s(84720),z=s(27792);let $;!function(e){e.USER="user",e.ENVIRONMENT="environment"}($||($={}));const _=e=>{let{switchFacingMode:t}=e;return(0,U.jsx)(E,{"data-testid":"stCameraInputSwitchButton",children:(0,U.jsx)(h.A,{content:"Switch camera",placement:h.W.TOP_RIGHT,children:(0,U.jsx)(k.Ay,{kind:X.KX.MINIMAL,onClick:t,children:(0,U.jsx)(c.A,{content:A.G,size:"twoXL",color:z.A.white})})})})};var W=s(21806),B=s(8151),D=s(2273),O=s(54806),V=s.n(O),G=s(39095);let N;!function(e){e.PENDING="pending",e.SUCCESS="success",e.ERROR="error"}(N||(N={}));const H=e=>{let{width:t}=e;return(0,U.jsxs)(v,{width:t,children:[(0,U.jsx)(c.A,{size:"threeXL",color:z.A.gray60,content:W.C}),(0,U.jsxs)(x,{children:["This app would like to use your camera.",(0,U.jsx)(y,{href:G.oe,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]})},Q=e=>{let{handleCapture:t,width:s,disabled:i,clearPhotoInProgress:o,setClearPhotoInProgress:a,facingMode:n,setFacingMode:l,testOverride:d}=e;const[c,h]=(0,r.useState)(d||N.PENDING),u=(0,r.useRef)(null),[g,p]=(0,r.useState)(s),m=(0,r.useCallback)((0,S.sg)(1e3,p),[]);(0,r.useEffect)((()=>{m(s)}),[s,m]);const f=(0,B.u)();return(0,U.jsxs)(F,{width:g,"data-testid":"stCameraInputWebcamComponent",children:[c===N.SUCCESS||i||o?D.Fr&&(0,U.jsx)(_,{switchFacingMode:l}):(0,U.jsx)(H,{width:g}),(0,U.jsx)(v,{"data-testid":"stCameraInputWebcamStyledBox",hidden:c!==N.SUCCESS&&!i&&!o,width:g,children:!i&&(0,U.jsx)(V(),{audio:!1,ref:u,screenshotFormat:"image/jpeg",screenshotQuality:1,width:g,height:9*g/16,style:{borderRadius:`${f.radii.default} ${f.radii.default} 0 0`},onUserMediaError:()=>{h(N.ERROR)},onUserMedia:()=>{h(N.SUCCESS),a(!1)},videoConstraints:{width:{ideal:g},facingMode:n}})}),(0,U.jsx)(P,{onClick:function(){if(null!==u.current){const e=u.current.getScreenshot();t(e)}},disabled:c!==N.SUCCESS||i||o,children:"Take Photo"})]})};class q extends r.PureComponent{constructor(e){super(e),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new m.o,this.getProgress=()=>{if(this.state.files.length>0&&"uploading"===this.state.files[this.state.files.length-1].status.type){return this.state.files[this.state.files.length-1].status.progress}},this.setClearPhotoInProgress=e=>{this.setState({clearPhotoInProgress:e})},this.setFacingMode=()=>{this.setState((e=>({facingMode:e.facingMode===$.USER?$.ENVIRONMENT:$.USER})))},this.handleCapture=e=>{if(null===e)return Promise.resolve();this.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});return(t=e,s=`camera-input-${(new Date).toISOString().replace(/:/g,"_")}.jpg`,fetch(t).then((e=>e.arrayBuffer())).then((e=>new File([e],s,{type:"image/jpeg"})))).then((e=>this.props.uploadClient.fetchFileURLs([e]).then((t=>({file:e,fileUrls:t[0]}))))).then((e=>{let{file:t,fileUrls:s}=e;return this.uploadFile(s,t)})).then((()=>{return e=150,new Promise((t=>setTimeout(t,e)));var e})).then((()=>{this.setState(((t,s)=>({imgSrc:e,shutter:t.shutter,minShutterEffectPassed:!0})))})).catch((e=>{(0,f.vV)(e)}));var t,s},this.removeCapture=()=>{0!==this.state.files.length&&(this.state.files.forEach((e=>this.deleteFile(e.id))),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if("ready"!==this.status)return;const e=this.createWidgetValue(),{element:t,widgetMgr:s,fragmentId:i}=this.props,r=s.getFileUploaderStateValue(t);l()(e,r)||s.setFileUploaderStateValue(t,e,{fromUi:!0},i)},this.onFormCleared=()=>{this.setState({files:[]},(()=>{const e=this.createWidgetValue();if((0,S.hX)(e))return;this.setState({imgSrc:null});const{widgetMgr:t,element:s,fragmentId:i}=this.props;t.setFileUploaderStateValue(s,e,{fromUi:!0},i)}))},this.deleteFile=e=>{const t=this.getFile(e);(0,S.hX)(t)||("uploading"===t.status.type&&t.status.cancelToken.cancel(),"uploaded"===t.status.type&&t.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(t.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState((t=>({files:[...t.files,e]})))},this.removeFile=e=>{this.setState((t=>({files:t.files.filter((t=>t.id!==e))})))},this.getFile=e=>this.state.files.find((t=>t.id===e)),this.updateFile=(e,t)=>{this.setState((s=>({files:s.files.map((s=>s.id===e?t:s))})))},this.onUploadComplete=(e,t)=>{this.setState((()=>({shutter:!1})));const s=this.getFile(e);(0,S.hX)(s)||"uploading"!==s.status.type||this.updateFile(s.id,s.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.onUploadProgress=(e,t)=>{const s=this.getFile(t);if((0,S.hX)(s)||"uploading"!==s.status.type)return;const i=Math.round(100*e.loaded/e.total);s.status.progress!==i&&this.updateFile(t,s.setStatus({type:"uploading",cancelToken:s.status.cancelToken,progress:i}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(e,t)=>{const s=a.A.CancelToken.source(),i=new C.m(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:s,progress:1});this.addFile(i),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,(e=>this.onUploadProgress(e,i.id)),s.token).then((()=>this.onUploadComplete(i.id,e))).catch((e=>{a.A.isCancel(e)||this.updateFile(i.id,i.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},this.state=this.initialValue}get initialValue(){const e={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:$.USER},{widgetMgr:t,element:s}=this.props,i=t.getFileUploaderStateValue(s);if((0,S.hX)(i))return e;const{uploadedFileInfo:r}=i;return(0,S.hX)(r)||0===r.length?e:{files:r.map((e=>{const t=e.name,s=e.size,i=e.fileId,r=e.fileUrls;return new C.m(t,s,this.nextLocalFileId(),{type:"uploaded",fileId:i,fileUrls:r})})),imgSrc:0===r.length?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:$.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){return this.state.files.some((e=>"uploading"===e.status.type))?"updating":"ready"}componentDidMount(){const e=this.createWidgetValue(),{element:t,widgetMgr:s,fragmentId:i}=this.props;void 0===s.getFileUploaderStateValue(t)&&s.setFileUploaderStateValue(t,e,{fromUi:!1},i)}createWidgetValue(){const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:s,status:i}=e;return new d.HY({fileId:i.fileId,fileUrls:i.fileUrls,name:t,size:s})}));return new d.qX({uploadedFileInfo:e})}render(){var e;const{element:t,widgetMgr:s,disabled:i,width:r}=this.props;return this.formClearHelper.manageFormClearListener(s,t.formId,this.onFormCleared),(0,U.jsxs)(F,{className:"stCameraInput","data-testid":"stCameraInput",width:r,children:[(0,U.jsx)(g.L,{label:t.label,disabled:i,labelVisibility:(0,S.yv)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,U.jsx)(p.j,{children:(0,U.jsx)(u.A,{content:t.help,placement:h.W.TOP_RIGHT})})}),this.state.imgSrc?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(v,{width:r,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&(0,U.jsx)(M,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:r,height:9*r/16})}),(0,U.jsx)(P,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||i,children:this.getProgress()?"Uploading...":(0,U.jsxs)(L,{children:[(0,U.jsx)(c.A,{content:o.X,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):(0,U.jsx)(Q,{handleCapture:this.handleCapture,width:r,disabled:i,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}const K=q},9830:(e,t,s)=>{s.d(t,{m:()=>i});class i{setStatus(e){return new i(this.name,this.size,this.id,e)}constructor(e,t,s,i){this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=e,this.size=t,this.id=s,this.status=i}}},34752:(e,t,s)=>{s.d(t,{X:()=>a,o:()=>o});var i=s(58878),r=s(25571);class o{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,s){(0,r.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,r._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,s),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function a(e){let{element:t,widgetMgr:s,onFormCleared:o}=e;(0,i.useEffect)((()=>{if(!(0,r._L)(t.formId))return;const e=s.addFormClearedListener(t.formId,o);return()=>{e.disconnect()}}),[t,s,o])}}}]);
|
@@ -0,0 +1,5 @@
|
|
1
|
+
(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[5618],{68035:(e,t,r)=>{"use strict";r.d(t,{A:()=>u});r(58878);var n=r(25571),o=r(78286),i=r(89653);const s=r(60667).i7`
|
2
|
+
50% {
|
3
|
+
color: rgba(0, 0, 0, 0);
|
4
|
+
}
|
5
|
+
`,a=(0,i.A)("span",{target:"edlqvik0"})((e=>{let{includeDot:t,shouldBlink:r,theme:n}=e;return{...t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:n.colors.gray,margin:`0 ${n.spacing.twoXS}`}}:{},...r?{color:n.colors.red,animationName:`${s}`,animationDuration:"0.5s",animationIterationCount:5}:{}}}),"");var l=r(90782);const u=e=>{let{dirty:t,value:r,inForm:i,maxLength:s,className:u,type:c="single",allowEnterToSubmit:d=!0}=e;const p=[],f=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];p.push((0,l.jsx)(a,{includeDot:p.length>0,shouldBlink:t,children:e},p.length))};if(d){const e=i?"submit form":"apply";if("multiline"===c){f(`Press ${(0,n.u_)()?"\u2318":"Ctrl"}+Enter to ${e}`)}else"single"===c&&f(`Press Enter to ${e}`)}return s&&("chat"!==c||t)&&f(`${r.length}/${s}`,t&&r.length>=s),(0,l.jsx)(o.tp,{"data-testid":"InputInstructions",className:u,children:p})}},34752:(e,t,r)=>{"use strict";r.d(t,{X:()=>s,o:()=>i});var n=r(58878),o=r(25571);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){(0,o.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,o._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function s(e){let{element:t,widgetMgr:r,onFormCleared:i}=e;(0,n.useEffect)((()=>{if(!(0,o._L)(t.formId))return;const e=r.addFormClearedListener(t.formId,i);return()=>{e.disconnect()}}),[t,r,i])}},25618:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>b});var n=r(58878),o=r(94928),i=r(8151),s=r(32698),a=r.n(s),l=r(34752),u=r(68035),c=r(70474),d=r(78286),p=r(93480),f=r(997),h=r(25571),m=r(90782);class y extends n.PureComponent{get initialValue(){var e;const t=this.props.widgetMgr.getStringValue(this.props.element);return null!==(e=null!==t&&void 0!==t?t:this.props.element.default)&&void 0!==e?e:null}constructor(e){super(e),this.formClearHelper=new l.o,this.id=void 0,this.state={dirty:!1,focused:!1,value:this.initialValue},this.commitWidgetValue=e=>{const{widgetMgr:t,element:r,fragmentId:n}=this.props;t.setStringValue(r,this.state.value,e,n),this.setState({dirty:!1})},this.onFormCleared=()=>{this.setState(((e,t)=>{var r;return{value:null!==(r=t.element.default)&&void 0!==r?r:null}}),(()=>this.commitWidgetValue({fromUi:!0})))},this.onBlur=()=>{this.state.dirty&&this.commitWidgetValue({fromUi:!0}),this.setState({focused:!1})},this.onFocus=()=>this.setState({focused:!0}),this.onChange=e=>{const{value:t}=e.target,{element:r}=this.props,{maxChars:n}=r;0!==n&&t.length>n||this.setState({dirty:!0,value:t})},this.isEnterKeyPressed=e=>{var t;const{keyCode:r,key:n}=e;return("Enter"===n||13===r||10===r)&&!(!0===(null===(t=e.nativeEvent)||void 0===t?void 0:t.isComposing))},this.onKeyDown=e=>{const{metaKey:t,ctrlKey:r}=e,{dirty:n}=this.state,{element:o,widgetMgr:i,fragmentId:s}=this.props,{formId:a}=o,l=i.allowFormEnterToSubmit(a);this.isEnterKeyPressed(e)&&(r||t)&&n&&(e.preventDefault(),this.commitWidgetValue({fromUi:!0}),l&&i.submitForm(a,s))},this.id=a()("text_area_")}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:null!==e&&void 0!==e?e:null},(()=>{this.commitWidgetValue({fromUi:!1})}))}render(){var e;const{element:t,disabled:r,width:n,widgetMgr:i,theme:s}=this.props,{dirty:a,focused:l,value:y}=this.state,b={width:n},{height:g,placeholder:v,formId:w}=t,O=(0,h.Ml)({formId:w})?i.allowFormEnterToSubmit(w):a,j=l&&n>s.breakpoints.hideWidgetDetails;this.formClearHelper.manageFormClearListener(i,w,this.onFormCleared);const F=g&&g<95?`${g}px`:"95px";return(0,m.jsxs)("div",{className:"stTextArea","data-testid":"stTextArea",style:b,children:[(0,m.jsx)(c.L,{label:t.label,disabled:r,labelVisibility:(0,h.yv)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),htmlFor:this.id,children:t.help&&(0,m.jsx)(d.j,{children:(0,m.jsx)(p.A,{content:t.help,placement:f.W.TOP_RIGHT})})}),(0,m.jsx)(o.A,{value:null!==y&&void 0!==y?y:"",placeholder:v,onBlur:this.onBlur,onFocus:this.onFocus,onChange:this.onChange,onKeyDown:this.onKeyDown,"aria-label":t.label,disabled:r,id:this.id,overrides:{Input:{style:{lineHeight:s.lineHeights.inputWidget,height:g?`${g}px`:"",minHeight:F,resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:s.spacing.lg,paddingLeft:s.spacing.lg,paddingBottom:s.spacing.lg,paddingTop:s.spacing.lg}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:{borderLeftWidth:s.sizes.borderWidth,borderRightWidth:s.sizes.borderWidth,borderTopWidth:s.sizes.borderWidth,borderBottomWidth:s.sizes.borderWidth}}}}),j&&(0,m.jsx)(u.A,{dirty:a,value:null!==y&&void 0!==y?y:"",maxLength:t.maxChars,type:"multiline",inForm:(0,h.Ml)({formId:w}),allowEnterToSubmit:O})]})}}const b=(0,i.b)(y)},94928:(e,t,r)=>{"use strict";r.d(t,{A:()=>x});var n=r(58878),o=r(35331),i=r(18648),s=r(92850),a=r(57224),l=r(81301);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}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 p=(0,a.I4)("div",(function(e){return c(c({},(0,l.vt)(c(c({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})}));p.displayName="StyledTextAreaRoot",p.displayName="StyledTextAreaRoot";var f=(0,a.I4)("div",(function(e){return(0,l.EO)(c({$positive:!1},e))}));f.displayName="StyledTextareaContainer",f.displayName="StyledTextareaContainer";var h=(0,a.I4)("textarea",(function(e){return c(c({},(0,l.n)(e)),{},{resize:e.$resize||"none"})}));function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(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 b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],s=!0,a=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);s=!0);}catch(l){a=!0,o=l}finally{try{s||null==r.return||r.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(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){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},w(e,t)}function O(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=F(e);if(t){var o=F(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===m(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return j(e)}(this,r)}}function j(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function F(e){return F=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},F(e)}function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}h.displayName="StyledTextarea",h.displayName="StyledTextarea";var C=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}(u,e);var t,r,a,l=O(u);function u(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return S(j(e=l.call.apply(l,[this].concat(r))),"state",{isFocused:e.props.autoFocus||!1}),S(j(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t)})),S(j(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t)})),e}return t=u,(r=[{key:"render",value:function(){var e=this.props.overrides,t=void 0===e?{}:e,r=b((0,o._O)(t.Root,p),2),a=r[0],l=r[1],u=(0,o.Qp)({Input:{component:h},InputContainer:{component:f}},t);return n.createElement(a,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},l),n.createElement(i.A,y({},this.props,{type:s.GT.textarea,overrides:u,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}])&&v(t.prototype,r),a&&v(t,a),Object.defineProperty(t,"prototype",{writable:!1}),u}(n.Component);S(C,"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:s.SK.default});const x=C},32698:(e,t,r)=>{var n=r(30136),o=0;e.exports=function(e){var t=++o;return n(e)+t}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[5711],{45711:(e,t,o)=>{o.r(t),o.d(t,{default:()=>P});var n=o(58878),i=o(8151),s=o(72037),a=o(59237),r=o(28430),l=o(71034),d=o.n(l),c=o(25571),h=o(84996),m=o(22044),u=o(67253),g=o(34752),p=o(85729);const f={DATAFRAME_INDEX:"(index)"},v=new Set([p.sj.DatetimeIndex,p.sj.Float64Index,p.sj.Int64Index,p.sj.RangeIndex,p.sj.UInt64Index]);function b(e){var t;if(0===(null===(t=e.datasets)||void 0===t?void 0:t.length))return null;const o={};return e.datasets.forEach((e=>{if(!e)return;const t=e.hasName?e.name:null;o[t]=e.data})),o}function w(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(e.isEmpty())return[];const o=[],{dataRows:n,dataColumns:i}=e.dimensions,s=p.D0.getTypeName(e.types.index[0]),a=v.has(s);for(let r=t;r<n;r++){const t={};if(a){const o=e.getIndexValue(r,0);t[f.DATAFRAME_INDEX]="bigint"===typeof o?Number(o):o}for(let o=0;o<i;o++){const n=e.getDataValue(r,o),i=e.types.data[o],s=p.D0.getTypeName(i);if("datetimetz"!==s&&(n instanceof Date||Number.isFinite(n))&&(s.startsWith("datetime")||"date"===s)){const i=60*new Date(n).getTimezoneOffset()*1e3;t[e.columns[0][o]]=n.valueOf()+i}else t[e.columns[0][o]]="bigint"===typeof n?Number(n):n}o.push(t)}return o}var x=o(37638),y=o.n(x),S=o(42274),F=o.n(S),C=o(58144);function z(e,t){const o={font:t.genericFonts.bodyFont,background:t.colors.bgColor,fieldTitle:"verbal",autosize:{type:"fit",contains:"padding"},title:{align:"left",anchor:"start",color:t.colors.headingColor,titleFontStyle:"normal",fontWeight:t.fontWeights.bold,fontSize:t.fontSizes.smPx+2,orient:"top",offset:26},header:{titleFontWeight:t.fontWeights.normal,titleFontSize:t.fontSizes.mdPx,titleColor:(0,C.lH)(t),titleFontStyle:"normal",labelFontSize:t.fontSizes.twoSmPx,labelFontWeight:t.fontWeights.normal,labelColor:(0,C.lH)(t),labelFontStyle:"normal"},axis:{labelFontSize:t.fontSizes.twoSmPx,labelFontWeight:t.fontWeights.normal,labelColor:(0,C.lH)(t),labelFontStyle:"normal",titleFontWeight:t.fontWeights.normal,titleFontSize:t.fontSizes.smPx,titleColor:(0,C.lH)(t),titleFontStyle:"normal",ticks:!1,gridColor:(0,C.V9)(t),domain:!1,domainWidth:1,domainColor:(0,C.V9)(t),labelFlush:!0,labelFlushOffset:1,labelBound:!1,labelLimit:100,titlePadding:t.spacing.lgPx,labelPadding:t.spacing.lgPx,labelSeparation:t.spacing.twoXSPx,labelOverlap:!0},legend:{labelFontSize:t.fontSizes.smPx,labelFontWeight:t.fontWeights.normal,labelColor:(0,C.lH)(t),titleFontSize:t.fontSizes.smPx,titleFontWeight:t.fontWeights.normal,titleFontStyle:"normal",titleColor:(0,C.lH)(t),titlePadding:5,labelPadding:t.spacing.lgPx,columnPadding:t.spacing.smPx,rowPadding:t.spacing.twoXSPx,padding:7,symbolStrokeWidth:4},range:{category:(0,C.c6)(t),diverging:(0,C.vk)(t),ramp:(0,C.rp)(t),heatmap:(0,C.rp)(t)},view:{columns:1,strokeWidth:0,stroke:"transparent",continuousHeight:350,continuousWidth:400},concat:{columns:1},facet:{columns:1},mark:{tooltip:!0,color:(0,C.h7)(t)},bar:{binSpacing:t.spacing.twoXSPx,discreteBandSize:{band:.85}},axisDiscrete:{grid:!1},axisXPoint:{grid:!1},axisTemporal:{grid:!1},axisXBand:{grid:!1}};return e?F()({},o,e,((e,t)=>Array.isArray(t)?t:void 0)):o}const V=(0,o(89653).A)("div",{target:"egd2k5h0"})((e=>{let{theme:t,useContainerWidth:o,isFullScreen:n}=e;return{width:o||n?"100%":"auto",height:n?"100%":"auto","&.vega-embed":{"&:hover summary, .vega-embed:focus summary":{background:"transparent"},"&.has-actions":{paddingRight:0},".vega-actions":{zIndex:t.zIndices.popupMenu,backgroundColor:t.colors.bgColor,boxShadow:"rgb(0 0 0 / 16%) 0px 4px 16px",border:`${t.sizes.borderWidth} solid ${t.colors.fadedText10}`,a:{fontFamily:t.genericFonts.bodyFont,fontWeight:t.fontWeights.normal,fontSize:t.fontSizes.md,margin:0,padding:`${t.spacing.twoXS} ${t.spacing.twoXL}`,color:t.colors.bodyText},"a:hover":{backgroundColor:t.colors.secondaryBg,color:t.colors.bodyText},":before":{content:"none"},":after":{content:"none"}},summary:{opacity:0,height:"auto",zIndex:t.zIndices.menuButton,border:"none",boxShadow:"none",borderRadius:t.radii.default,color:t.colors.fadedText10,backgroundColor:"transparent",transition:"opacity 300ms 150ms,transform 300ms 150ms","&:active, &:focus-visible, &:hover":{border:"none",boxShadow:"none",color:t.colors.bodyText,opacity:"1 !important",background:t.colors.darkenedBgMix25}}}}}),"");var W=o(90782);const D="source";class I extends n.PureComponent{constructor(){super(...arguments),this.vegaView=void 0,this.vegaFinalizer=void 0,this.defaultDataName=D,this.element=null,this.formClearHelper=new g.o,this.state={error:void 0},this.finalizeView=()=>{this.vegaFinalizer&&this.vegaFinalizer(),this.vegaFinalizer=void 0,this.vegaView=void 0},this.generateSpec=()=>{var e,t;const{element:o,theme:n,isFullScreen:i,width:s,height:a}=this.props,r=JSON.parse(o.spec),{useContainerWidth:l}=o;if("streamlit"===o.vegaLiteTheme?r.config=z(r.config,n):"streamlit"===(null===(e=r.usermeta)||void 0===e||null===(t=e.embedOptions)||void 0===t?void 0:t.theme)?(r.config=z(r.config,n),r.usermeta.embedOptions.theme=void 0):r.config=function(e,t){const{colors:o,fontSizes:n,genericFonts:i}=t,s={labelFont:i.bodyFont,titleFont:i.bodyFont,labelFontSize:n.twoSmPx,titleFontSize:n.twoSmPx},a={background:o.bgColor,axis:{labelColor:o.bodyText,titleColor:o.bodyText,gridColor:(0,C.V9)(t),...s},legend:{labelColor:o.bodyText,titleColor:o.bodyText,...s},title:{color:o.bodyText,subtitleColor:o.bodyText,...s},header:{labelColor:o.bodyText,titleColor:o.bodyText,...s},view:{stroke:(0,C.V9)(t),continuousHeight:350,continuousWidth:400},mark:{tooltip:!0}};return e?y()({},a,e):a}(r.config,n),i?(r.width=s,r.height=a,"vconcat"in r&&r.vconcat.forEach((e=>{e.width=s}))):l&&(r.width=s,"vconcat"in r&&r.vconcat.forEach((e=>{e.width=s}))),r.padding||(r.padding={}),(0,c.hX)(r.padding.bottom)&&(r.padding.bottom=20),r.datasets)throw new Error("Datasets should not be passed as part of the spec");return o.selectionMode.length>0&&function(e){"params"in e&&"encoding"in e&&e.params.forEach((t=>{"select"in t&&(["interval","point"].includes(t.select)&&(t.select={type:t.select}),"type"in t.select&&"point"===t.select.type&&!("encodings"in t.select)&&(0,c.hX)(t.select.encodings)&&(t.select.encodings=Object.keys(e.encoding)))}))}(r),r},this.maybeConfigureSelections=()=>{if(void 0===this.vegaView)return;const{widgetMgr:e,element:t}=this.props;if(null===t||void 0===t||!t.id||0===t.selectionMode.length)return;const o=e.getElementState(this.props.element.id,"viewState");if((0,c.se)(o))try{this.vegaView=this.vegaView.setState(o)}catch(i){(0,h.FF)("Failed to restore view state",i)}t.selectionMode.forEach(((o,n)=>{var i;null===(i=this.vegaView)||void 0===i||i.addSignalListener(o,(0,c.sg)(150,((o,n)=>{var i;const s=null===(i=this.vegaView)||void 0===i?void 0:i.getState({data:(e,o)=>t.selectionMode.some((t=>`${t}_store`===e)),recurse:!1});(0,c.se)(s)&&e.setElementState(t.id,"viewState",s);let a=n;"vlPoint"in n&&"or"in n.vlPoint&&(a=n.vlPoint.or);const r=JSON.parse(e.getStringValue(t)||"{}"),l={selection:{...(null===r||void 0===r?void 0:r.selection)||{},[o]:a||{}}};d()(r,l)||e.setStringValue(t,JSON.stringify(l),{fromUi:!0},this.props.fragmentId)})))}));const n=()=>{const o={selection:{}};this.props.element.selectionMode.forEach((e=>{o.selection[e]={}}));const n=e.getStringValue(t),i=n?JSON.parse(n):o;var s;d()(i,o)||(null===(s=this.props.widgetMgr)||void 0===s||s.setStringValue(this.props.element,JSON.stringify(o),{fromUi:!0},this.props.fragmentId))};this.props.element.formId&&this.formClearHelper.manageFormClearListener(this.props.widgetMgr,this.props.element.formId,n)}}async componentDidMount(){try{await this.createView()}catch(e){const t=(0,u.$)(e);this.setState({error:t})}}componentWillUnmount(){this.finalizeView()}async componentDidUpdate(e){const{element:t,theme:o}=e,{element:n,theme:i}=this.props,s=t.spec,{spec:a}=n;if(!this.vegaView||s!==a||o!==i||e.width!==this.props.width||e.height!==this.props.height||e.element.vegaLiteTheme!==this.props.element.vegaLiteTheme||!d()(e.element.selectionMode,this.props.element.selectionMode)){(0,h.OG)("Vega spec changed.");try{await this.createView()}catch(g){const e=(0,u.$)(g);this.setState({error:e})}return}const r=t.data,{data:l}=n;(r||l)&&this.updateData(this.defaultDataName,r,l);const c=b(t)||{},m=b(n)||{};for(const[d,h]of Object.entries(m)){const e=d||this.defaultDataName,t=c[e];this.updateData(e,t,h)}for(const d of Object.keys(c))m.hasOwnProperty(d)||d===this.defaultDataName||this.updateData(d,null,null);this.vegaView.resize().runAsync()}updateData(e,t,o){if(!this.vegaView)throw new Error("Chart has not been drawn yet");if(!o||0===o.data.numRows)try{this.vegaView.remove(e,a.truthy)}finally{return}if(!t||0===t.data.numRows)return void this.vegaView.insert(e,w(o));const{dataRows:n,dataColumns:i}=t.dimensions,{dataRows:s,dataColumns:r}=o.dimensions;!function(e,t,o,n,i,s){if(o!==s)return!1;if(t>=i)return!1;if(0===t)return!1;const a=s-1,r=t-1;return e.getDataValue(0,a)===n.getDataValue(0,a)&&e.getDataValue(r,a)===n.getDataValue(r,a)}(t,n,i,o,s,r)?(this.vegaView.data(e,w(o)),(0,h.OG)(`Had to clear the ${e} dataset before inserting data through Vega view.`)):n<s&&this.vegaView.insert(e,w(o,n))}async createView(){if((0,h.OG)("Creating a new Vega view."),!this.element)throw Error("Element missing.");this.finalizeView();const{element:e}=this.props,t=this.generateSpec(),o={ast:!0,expr:r.P,tooltip:{disableDefaultStyle:!0},defaultStyle:!1,forceActionsMenu:!0},{vgSpec:n,view:i,finalize:a}=await(0,s.Ay)(this.element,t,o);this.vegaView=i,this.maybeConfigureSelections(),this.vegaFinalizer=a;const l=function(e){const t=b(e);if((0,c.hX)(t))return null;const o={};for(const[n,i]of Object.entries(t))o[n]=w(i);return o}(e),d=l?Object.keys(l):[];if(1===d.length){const[e]=d;this.defaultDataName=e}else 0===d.length&&n.data&&(this.defaultDataName=D);const m=function(e){const t=e.data;return t&&0!==t.data.numRows?w(t):null}(e);if(m&&i.insert(this.defaultDataName,m),l)for(const[s,r]of Object.entries(l))i.insert(s,r);await i.runAsync(),this.vegaView.resize().runAsync()}render(){if(this.state.error)throw this.state.error;return(0,W.jsx)(V,{"data-testid":"stVegaLiteChart",className:"stVegaLiteChart",useContainerWidth:this.props.element.useContainerWidth,isFullScreen:this.props.isFullScreen,ref:e=>{this.element=e}})}}const P=(0,i.b)((0,m.A)(I))},22044:(e,t,o)=>{o.d(t,{A:()=>v});var n=o(58878),i=o(53124),s=o.n(i),a=o(8151),r=o(41514),l=o(67214),d=o(64611),c=o(84152),h=o(89653);const m=(0,h.A)("button",{target:"e1vs0wn31"})((e=>{let{isExpanded:t,theme:o}=e;const n=t?{right:"0.4rem",top:"0.5rem",backgroundColor:"transparent"}:{right:"-3.0rem",top:"-0.375rem",opacity:0,transform:"scale(0)",backgroundColor:o.colors.lightenedBg05};return{position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",zIndex:o.zIndices.sidebar+1,height:"2.5rem",width:"2.5rem",transition:"opacity 300ms 150ms, transform 300ms 150ms",border:"none",color:o.colors.fadedText60,borderRadius:"50%",...n,"&:focus":{outline:"none"},"&:active, &:focus-visible, &:hover":{opacity:1,outline:"none",transform:"scale(1)",color:o.colors.bodyText,transition:"none"}}}),""),u=(0,h.A)("div",{target:"e1vs0wn30"})((e=>{let{theme:t,isExpanded:o}=e;return{"&:hover":{[m]:{opacity:1,transform:"scale(1)",transition:"none"}},...o?{position:"fixed",top:0,left:0,bottom:0,right:0,background:t.colors.bgColor,zIndex:t.zIndices.fullscreenWrapper,padding:t.spacing.md,paddingTop:t.sizes.fullScreenHeaderHeight,overflow:["auto","overlay"],display:"flex",alignItems:"center",justifyContent:"center"}:{}}}),"");var g=o(90782);class p extends n.PureComponent{constructor(e){super(e),this.context=void 0,this.controlKeys=e=>{const{expanded:t}=this.state;27===e.keyCode&&t&&this.zoomOut()},this.zoomIn=()=>{document.body.style.overflow="hidden",this.context.setFullScreen(!0),this.setState({expanded:!0})},this.zoomOut=()=>{document.body.style.overflow="unset",this.context.setFullScreen(!1),this.setState({expanded:!1})},this.convertScssRemValueToPixels=e=>parseFloat(e)*parseFloat(getComputedStyle(document.documentElement).fontSize),this.getWindowDimensions=()=>{const e=this.convertScssRemValueToPixels(this.props.theme.spacing.md),t=this.convertScssRemValueToPixels(this.props.theme.sizes.fullScreenHeaderHeight);return{fullWidth:window.innerWidth-2*e,fullHeight:window.innerHeight-(e+t)}},this.updateWindowDimensions=()=>{this.setState(this.getWindowDimensions())},this.state={expanded:!1,...this.getWindowDimensions()}}componentDidMount(){window.addEventListener("resize",this.updateWindowDimensions),document.addEventListener("keydown",this.controlKeys,!1)}componentWillUnmount(){window.removeEventListener("resize",this.updateWindowDimensions),document.removeEventListener("keydown",this.controlKeys,!1)}render(){const{expanded:e,fullWidth:t,fullHeight:o}=this.state,{children:n,width:i,height:s,disableFullscreenMode:a}=this.props;let c=r.u,h=this.zoomIn,p="View fullscreen";return e&&(c=l.Q,h=this.zoomOut,p="Exit fullscreen"),(0,g.jsxs)(u,{isExpanded:e,"data-testid":"stFullScreenFrame",children:[!a&&(0,g.jsx)(m,{"data-testid":"StyledFullScreenButton",onClick:h,title:p,isExpanded:e,children:(0,g.jsx)(d.A,{content:c})}),n(e?{width:t,height:o,expanded:e,expand:this.zoomIn,collapse:this.zoomOut}:{width:i,height:s,expanded:e,expand:this.zoomIn,collapse:this.zoomOut})]})}}p.contextType=c.n;const f=(0,a.b)(p);const v=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];class o extends n.PureComponent{constructor(){super(...arguments),this.render=()=>{const{width:o,height:n,disableFullscreenMode:i}=this.props;return(0,g.jsx)(f,{width:o,height:n,disableFullscreenMode:t||i,children:t=>{let{width:o,height:n,expanded:i,expand:s,collapse:a}=t;return(0,g.jsx)(e,{...this.props,width:o,height:n,isFullScreen:i,expand:s,collapse:a})}})}}}return o.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,s()(o,e)}},34752:(e,t,o)=>{o.d(t,{X:()=>a,o:()=>s});var n=o(58878),i=o(25571);class s{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,o){(0,i.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,i._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,o),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function a(e){let{element:t,widgetMgr:o,onFormCleared:s}=e;(0,n.useEffect)((()=>{if(!(0,i._L)(t.formId))return;const e=o.addFormClearedListener(t.formId,s);return()=>{e.disconnect()}}),[t,o,s])}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[7193],{17193:(e,t,r)=>{r.r(t),r.d(t,{default:()=>m});var a=r(58878),l=r(42637),i=r(25571),d=r(3101),o=r(90782);const s=(e,t)=>e.getStringValue(t),n=e=>{var t;return null!==(t=e.default)&&void 0!==t?t:null},g=e=>{var t;return null!==(t=e.value)&&void 0!==t?t:null},u=(e,t,r,a)=>{t.setStringValue(e,r.value,{fromUi:r.fromUi},a)},m=e=>{var t;let{element:r,disabled:m,widgetMgr:f,width:v,fragmentId:c}=e;const[h,M]=(0,d.t)({getStateFromWidgetMgr:s,getDefaultStateFromProto:n,getCurrStateFromProto:g,updateWidgetMgrState:u,element:r,widgetMgr:f,fragmentId:c}),C=(0,a.useCallback)((e=>{M({value:e,fromUi:!0})}),[M]);return(0,o.jsx)(l.A,{label:r.label,labelVisibility:(0,i.yv)(null===(t=r.labelVisibility)||void 0===t?void 0:t.value),help:r.help,onChange:C,disabled:m,width:v,value:h})}},34752:(e,t,r)=>{r.d(t,{X:()=>d,o:()=>i});var a=r(58878),l=r(25571);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){(0,l.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,l._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function d(e){let{element:t,widgetMgr:r,onFormCleared:i}=e;(0,a.useEffect)((()=>{if(!(0,l._L)(t.formId))return;const e=r.addFormClearedListener(t.formId,i);return()=>{e.disconnect()}}),[t,r,i])}},3101:(e,t,r)=>{r.d(t,{_:()=>d,t:()=>o});var a=r(58878),l=r(34752),i=r(25571);function d(e){let{getStateFromWidgetMgr:t,getDefaultState:r,updateWidgetMgrState:d,element:o,widgetMgr:s,fragmentId:n}=e;const[g,u]=(0,a.useState)((()=>{var e;return null!==(e=t(s,o))&&void 0!==e?e:r(s,o)})),[m,f]=(0,a.useState)({value:g,fromUi:!1});(0,a.useEffect)((()=>{(0,i.hX)(m)||(f(null),u(m.value),d(o,s,m,n))}),[m,d,o,s,n]);const v=(0,a.useCallback)((()=>{f({value:r(s,o),fromUi:!0})}),[f,o,r,s]);return(0,l.X)({widgetMgr:s,element:o,onFormCleared:v}),[g,f]}function o(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:r,getCurrStateFromProto:l,updateWidgetMgrState:i,element:o,widgetMgr:s,fragmentId:n}=e;const g=(0,a.useCallback)(((e,t)=>r(t)),[r]),[u,m]=d({getStateFromWidgetMgr:t,getDefaultState:g,updateWidgetMgrState:i,element:o,widgetMgr:s,fragmentId:n});return(0,a.useEffect)((()=>{o.setValue&&(o.setValue=!1,m({value:l(o),fromUi:!1}))}),[o,l,m]),[u,m]}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[7809],{97809:(e,t,r)=>{r.r(t),r.d(t,{default:()=>C});var s=r(58878),n=r(9887),i=r.n(n),o=r(58144),a=r(34914),l=r(84152),c=r(89653),d=r(74829),h=r(37888);const p=(0,c.A)(h.x,{shouldForwardProp:d.A,target:"e1se5lgy2"})((e=>{let{theme:t,usingCustomTheme:r}=e;return{fontSize:t.fontSizes.sm,width:t.sizes.spinnerSize,height:t.sizes.spinnerSize,borderWidth:t.sizes.spinnerThickness,radius:t.radii.md,justifyContents:"center",padding:t.spacing.none,margin:t.spacing.none,borderColor:t.colors.borderColor,borderTopColor:r?t.colors.primary:t.colors.blue70,flexGrow:0,flexShrink:0}}),""),g=(0,c.A)("div",{target:"e1se5lgy1"})((e=>{let{theme:t,width:r,cache:s}=e;return{width:r,...s?{paddingBottom:t.spacing.lg,background:`linear-gradient(to bottom, ${t.colors.bgColor} 0%, ${t.colors.bgColor} 80%, transparent 100%)`}:null}}),""),u=(0,c.A)("div",{target:"e1se5lgy0"})((e=>{let{theme:t}=e;return{display:"flex",gap:t.spacing.sm,alignItems:"center",width:"100%"}}),"");var m=r(90782);const C=function(e){let{width:t,element:r}=e;const{activeTheme:n}=s.useContext(l.n),c=!(0,o.tl)(n),{cache:d}=r;return(0,m.jsx)(g,{className:i()({stSpinner:!0,stCacheSpinner:d}),"data-testid":"stSpinner",width:t,cache:d,children:(0,m.jsxs)(u,{children:[(0,m.jsx)(p,{usingCustomTheme:c}),(0,m.jsx)(a.Ay,{source:r.text,allowHTML:!1})]})})}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[8166],{34752:(e,t,r)=>{r.d(t,{X:()=>o,o:()=>i});var a=r(58878),l=r(25571);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){(0,l.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,l._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function o(e){let{element:t,widgetMgr:r,onFormCleared:i}=e;(0,a.useEffect)((()=>{if(!(0,l._L)(t.formId))return;const e=r.addFormClearedListener(t.formId,i);return()=>{e.disconnect()}}),[t,r,i])}},38166:(e,t,r)=>{r.r(t),r.d(t,{default:()=>m});var a=r(58878),l=r(4871),i=r(25571),o=r(3101),d=r(90782);const s=(e,t)=>e.getIntValue(t),n=e=>{var t;return null!==(t=e.default)&&void 0!==t?t:null},u=e=>{var t;return null!==(t=e.value)&&void 0!==t?t:null},g=(e,t,r,a)=>{t.setIntValue(e,r.value,{fromUi:r.fromUi},a)},m=e=>{let{disabled:t,element:r,widgetMgr:m,width:f,fragmentId:c}=e;const{options:v,help:h,label:M,labelVisibility:C,placeholder:p}=r,[F,S]=(0,o.t)({getStateFromWidgetMgr:s,getDefaultStateFromProto:n,getCurrStateFromProto:u,updateWidgetMgrState:g,element:r,widgetMgr:m,fragmentId:c}),b=(0,a.useCallback)((e=>{S({value:e,fromUi:!0})}),[S]),I=(0,i.hX)(r.default)&&!t;return(0,d.jsx)(l.Ay,{label:M,labelVisibility:(0,i.yv)(null===C||void 0===C?void 0:C.value),options:v,disabled:t,width:f,onChange:b,value:F,help:h,placeholder:p,clearable:I})}},3101:(e,t,r)=>{r.d(t,{_:()=>o,t:()=>d});var a=r(58878),l=r(34752),i=r(25571);function o(e){let{getStateFromWidgetMgr:t,getDefaultState:r,updateWidgetMgrState:o,element:d,widgetMgr:s,fragmentId:n}=e;const[u,g]=(0,a.useState)((()=>{var e;return null!==(e=t(s,d))&&void 0!==e?e:r(s,d)})),[m,f]=(0,a.useState)({value:u,fromUi:!1});(0,a.useEffect)((()=>{(0,i.hX)(m)||(f(null),g(m.value),o(d,s,m,n))}),[m,o,d,s,n]);const c=(0,a.useCallback)((()=>{f({value:r(s,d),fromUi:!0})}),[f,d,r,s]);return(0,l.X)({widgetMgr:s,element:d,onFormCleared:c}),[u,f]}function d(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:r,getCurrStateFromProto:l,updateWidgetMgrState:i,element:d,widgetMgr:s,fragmentId:n}=e;const u=(0,a.useCallback)(((e,t)=>r(t)),[r]),[g,m]=o({getStateFromWidgetMgr:t,getDefaultState:u,updateWidgetMgrState:i,element:d,widgetMgr:s,fragmentId:n});return(0,a.useEffect)((()=>{d.setValue&&(d.setValue=!1,m({value:l(d),fromUi:!1}))}),[d,l,m]),[g,m]}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[8237],{78237:(e,o,t)=>{t.r(o),t.d(o,{default:()=>w});var l=t(58878),n=t(8151),i=t(43978),r=t(29669),s=t(22044),c=t(25571),a=t(34752),d=t(37638),p=t.n(d),u=t(58144),h=t(67253),m=t(84996);function f(e,o,t){return e=function(e,o){return(e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("#000032",(0,u.$E)(o))).replaceAll("#000033",(0,u.pf)(o))).replaceAll("#000034",(0,u.h7)(o))).replaceAll("#000035",(0,u.V9)(o))).replaceAll("#000036",(0,u.lH)(o))).replaceAll("#000037",(0,u.ZA)(o))).replaceAll("#000038",o.colors.bgColor)).replaceAll("#000039",o.colors.fadedText05)).replaceAll("#000040",o.colors.bgMix)}(e,o),e=function(e,o,t){const l="#000001",n="#000002",i="#000003",r="#000004",s="#000005",c="#000006",a="#000007",d="#000008",p="#000009",h="#000010";if("streamlit"===t){const t=(0,u.c6)(o);e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll(l,t[0])).replaceAll(n,t[1])).replaceAll(i,t[2])).replaceAll(r,t[3])).replaceAll(s,t[4])).replaceAll(c,t[5])).replaceAll(a,t[6])).replaceAll(d,t[7])).replaceAll(p,t[8])).replaceAll(h,t[9])}else e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll(l,"#636efa")).replaceAll(n,"#EF553B")).replaceAll(i,"#00cc96")).replaceAll(r,"#ab63fa")).replaceAll(s,"#FFA15A")).replaceAll(c,"#19d3f3")).replaceAll(a,"#FF6692")).replaceAll(d,"#B6E880")).replaceAll(p,"#FF97FF")).replaceAll(h,"#FECB52");return e}(e,o,t),e=function(e,o,t){const l="#000011",n="#000012",i="#000013",r="#000014",s="#000015",c="#000016",a="#000017",d="#000018",p="#000019",h="#000020";if("streamlit"===t){const t=(0,u.rp)(o);e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll(l,t[0])).replaceAll(n,t[1])).replaceAll(i,t[2])).replaceAll(r,t[3])).replaceAll(s,t[4])).replaceAll(c,t[5])).replaceAll(a,t[6])).replaceAll(d,t[7])).replaceAll(p,t[8])).replaceAll(h,t[9])}else e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll(l,"#0d0887")).replaceAll(n,"#46039f")).replaceAll(i,"#7201a8")).replaceAll(r,"#9c179e")).replaceAll(s,"#bd3786")).replaceAll(c,"#d8576b")).replaceAll(a,"#ed7953")).replaceAll(d,"#fb9f3a")).replaceAll(p,"#fdca26")).replaceAll(h,"#f0f921");return e}(e,o,t),e=function(e,o,t){const l="#000021",n="#000022",i="#000023",r="#000024",s="#000025",c="#000026",a="#000027",d="#000028",p="#000029",h="#000030",m="#000031";if("streamlit"===t){const t=(0,u.vk)(o);e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll(l,t[0])).replaceAll(n,t[1])).replaceAll(i,t[2])).replaceAll(r,t[3])).replaceAll(s,t[4])).replaceAll(c,t[5])).replaceAll(a,t[6])).replaceAll(d,t[7])).replaceAll(p,t[8])).replaceAll(h,t[9])).replaceAll(m,t[10])}else e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll(l,"#8e0152")).replaceAll(n,"#c51b7d")).replaceAll(i,"#de77ae")).replaceAll(r,"#f1b6da")).replaceAll(s,"#fde0ef")).replaceAll(c,"#f7f7f7")).replaceAll(a,"#e6f5d0")).replaceAll(d,"#b8e186")).replaceAll(p,"#7fbc41")).replaceAll(h,"#4d9221")).replaceAll(m,"#276419");return e}(e,o,t),e}function g(e,o){try{!function(e,o){const{genericFonts:t,colors:l,fontSizes:n}=o,i={font:{color:(0,u.lH)(o),family:t.bodyFont,size:n.twoSmPx},title:{color:l.headingColor,subtitleColor:l.bodyText,font:{family:t.headingFont,size:n.mdPx,color:l.headingColor},pad:{l:o.spacing.twoXSPx},xanchor:"left",x:0},legend:{title:{font:{size:n.twoSmPx,color:(0,u.lH)(o)},side:"top"},valign:"top",bordercolor:l.transparent,borderwidth:o.spacing.nonePx,font:{size:n.twoSmPx,color:(0,u.ZA)(o)}},paper_bgcolor:l.bgColor,plot_bgcolor:l.bgColor,yaxis:{ticklabelposition:"outside",zerolinecolor:(0,u.V9)(o),title:{font:{color:(0,u.lH)(o),size:n.smPx},standoff:o.spacing.twoXLPx},tickcolor:(0,u.V9)(o),tickfont:{color:(0,u.lH)(o),size:n.twoSmPx},gridcolor:(0,u.V9)(o),minor:{gridcolor:(0,u.V9)(o)},automargin:!0},xaxis:{zerolinecolor:(0,u.V9)(o),gridcolor:(0,u.V9)(o),showgrid:!1,tickfont:{color:(0,u.lH)(o),size:n.twoSmPx},tickcolor:(0,u.V9)(o),title:{font:{color:(0,u.lH)(o),size:n.smPx},standoff:o.spacing.xlPx},minor:{gridcolor:(0,u.V9)(o)},zeroline:!1,automargin:!0,rangeselector:{bgcolor:l.bgColor,bordercolor:(0,u.V9)(o),borderwidth:1,x:0}},margin:{pad:o.spacing.smPx,r:o.spacing.nonePx,l:o.spacing.nonePx},hoverlabel:{bgcolor:l.bgColor,bordercolor:l.borderColor,font:{color:(0,u.lH)(o),family:t.bodyFont,size:n.twoSmPx}},coloraxis:{colorbar:{thickness:16,xpad:o.spacing.twoXLPx,ticklabelposition:"outside",outlinecolor:l.transparent,outlinewidth:8,len:.75,y:.5745,title:{font:{color:(0,u.lH)(o),size:n.smPx}},tickfont:{color:(0,u.lH)(o),size:n.twoSmPx}}},ternary:{gridcolor:(0,u.lH)(o),bgcolor:l.bgColor,title:{font:{family:t.bodyFont,size:n.smPx}},color:(0,u.lH)(o),aaxis:{gridcolor:(0,u.lH)(o),linecolor:(0,u.lH)(o),tickfont:{family:t.bodyFont,size:n.twoSmPx}},baxis:{linecolor:(0,u.lH)(o),gridcolor:(0,u.lH)(o),tickfont:{family:t.bodyFont,size:n.twoSmPx}},caxis:{linecolor:(0,u.lH)(o),gridcolor:(0,u.lH)(o),tickfont:{family:t.bodyFont,size:n.twoSmPx}}}};p()(e,i)}(e.layout.template.layout,o)}catch(t){const e=(0,h.$)(t);(0,m.vV)(e)}"title"in e.layout&&(e.layout.title=p()(e.layout.title,{text:`<b>${e.layout.title.text}</b>`}))}var y=t(90782);const x={width:600,height:470,name:"fullscreen-expand",path:"M32 32C14.3 32 0 46.3 0 64v96c0 17.7 14.3 32 32 32s32-14.3 32-32V96h64c17.7 0 32-14.3 32-32s-14.3-32-32-32H32zM64 352c0-17.7-14.3-32-32-32s-32 14.3-32 32v96c0 17.7 14.3 32 32 32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H64V352zM320 32c-17.7 0-32 14.3-32 32s14.3 32 32 32h64v64c0 17.7 14.3 32 32 32s32-14.3 32-32V64c0-17.7-14.3-32-32-32H320zM448 352c0-17.7-14.3-32-32-32s-32 14.3-32 32v64H320c-17.7 0-32 14.3-32 32s14.3 32 32 32h96c17.7 0 32-14.3 32-32V352z"},v={width:600,height:470,name:"fullscreen-collapse",path:"M160 64c0-17.7-14.3-32-32-32s-32 14.3-32 32v64H32c-17.7 0-32 14.3-32 32s14.3 32 32 32h96c17.7 0 32-14.3 32-32V64zM32 320c-17.7 0-32 14.3-32 32s14.3 32 32 32H96v64c0 17.7 14.3 32 32 32s32-14.3 32-32V352c0-17.7-14.3-32-32-32H32zM352 64c0-17.7-14.3-32-32-32s-32 14.3-32 32v96c0 17.7 14.3 32 32 32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H352V64zM320 320c-17.7 0-32 14.3-32 32v96c0 17.7 14.3 32 32 32s32-14.3 32-32V384h64c17.7 0 32-14.3 32-32s-14.3-32-32-32H320z"};function A(e,o,t){const l=JSON.parse(f(JSON.stringify(e),t,o));return"streamlit"===o?g(l,t):l.layout=function(e,o){const{colors:t,genericFonts:l}=o,n={font:{color:t.bodyText,family:l.bodyFont},paper_bgcolor:t.bgColor,plot_bgcolor:t.secondaryBg};return{...e,font:{...n.font,...e.font},paper_bgcolor:e.paper_bgcolor||n.paper_bgcolor,plot_bgcolor:e.plot_bgcolor||n.plot_bgcolor}}(l.layout,t),l}function b(e,o,t,l){if(!e)return;const n={selection:{points:[],point_indices:[],box:[],lasso:[]}},i=new Set,s=[],a=[],d=[],{selections:p,points:u}=e;if(u&&u.forEach((function(e){d.push({...e,legendgroup:e.data.legendgroup||void 0,data:void 0,fullData:void 0}),(0,c.se)(e.pointIndex)&&i.add(e.pointIndex),(0,c.se)(e.pointIndices)&&e.pointIndices.length>0&&e.pointIndices.forEach((e=>i.add(e)))})),p&&p.forEach((e=>{if("rect"===e.type){const o=function(e){return"x0"in e&&"x1"in e&&"y0"in e&&"y1"in e?{x:[e.x0,e.x1],y:[e.y0,e.y1]}:{x:[],y:[]}}(e),t={xref:e.xref,yref:e.yref,x:o.x,y:o.y};s.push(t)}if("path"===e.type){const o=function(e){if(""===e)return{x:[],y:[]};const o=e.replace("M","").replace("Z","").split("L"),t=[],l=[];return o.forEach((e=>{const[o,n]=e.split(",").map(Number);t.push(o),l.push(n)})),{x:t,y:l}}(e.path),t={xref:e.xref,yref:e.yref,x:o.x,y:o.y};a.push(t)}})),n.selection.point_indices=Array.from(i),n.selection.points=d.map((e=>(0,c.wJ)(e))),n.selection.box=s,n.selection.lasso=a,n.selection.box.length>0&&!t.selectionMode.includes(r.P_.SelectionMode.BOX))return;if(n.selection.lasso.length>0&&!t.selectionMode.includes(r.P_.SelectionMode.LASSO))return;const h=o.getStringValue(t),m=JSON.stringify(n);h!==m&&o.setStringValue(t,m,{fromUi:!0},l)}const w=(0,s.A)((function(e){var o,t,s,c,d;let{element:p,width:u,height:h,widgetMgr:m,disabled:f,fragmentId:g,isFullScreen:w,expand:S,collapse:z,disableFullscreenMode:F}=e;const C=(0,n.u)(),M=(0,l.useMemo)((()=>p.spec?JSON.parse(p.spec):{layout:{},data:[],frames:void 0}),[p.id,p.spec]),[P,H]=(0,l.useState)((()=>{const e=m.getElementState(p.id,"figure");return e||A(M,p.theme,C)})),k=p.selectionMode.length>0&&!f,I=k&&p.selectionMode.includes(r.P_.SelectionMode.LASSO),V=k&&p.selectionMode.includes(r.P_.SelectionMode.BOX),E=k&&p.selectionMode.includes(r.P_.SelectionMode.POINTS),_=(0,l.useMemo)((()=>{if(!p.config)return{};const e=JSON.parse(p.config);var o;F||(e.modeBarButtonsToAdd=[{name:w?"Close fullscreen":"Fullscreen",icon:w?v:x,click:()=>{w&&z?z():S&&S()}},...null!==(o=e.modeBarButtonsToAdd)&&void 0!==o?o:[]]);if(!e.modeBarButtonsToRemove){e.displaylogo=!1;const o=["sendDataToCloud"];k?(I||o.push("lasso2d"),V||o.push("select2d")):o.push("lasso2d","select2d"),e.modeBarButtonsToRemove=o}return e}),[p.id,p.config,w,F,k,I,V,z,S]);(0,l.useEffect)((()=>{H((e=>A(e,p.theme,C)))}),[p.id,C,p.theme]),(0,l.useEffect)((()=>{let e=M.layout.clickmode,o=M.layout.hovermode,t=M.layout.dragmode;f?(e="none",t="pan"):k&&(M.layout.clickmode||(e=E?"event+select":"none"),M.layout.hovermode||(o="closest"),M.layout.dragmode||(t=E?"pan":V?"select":I?"lasso":"pan")),H((l=>l.layout.clickmode===e&&l.layout.hovermode===o&&l.layout.dragmode===t?l:{...l,layout:{...l.layout,clickmode:e,hovermode:o,dragmode:t}}))}),[p.id,k,E,V,I,f]);let L=-1===u?null===(o=P.layout)||void 0===o?void 0:o.width:Math.max(p.useContainerWidth?u:Math.min(null!==(t=M.layout.width)&&void 0!==t?t:u,u),150),T=M.layout.height;w&&(L=u,T=h),P.layout.height===T&&P.layout.width===L||H((e=>({...e,layout:{...e.layout,height:T,width:L}})));const W=(0,l.useCallback)((e=>{b(e,m,p,g)}),[p.id,m,g]),B=(0,l.useCallback)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!function(e,o,t){const l=e.getStringValue(o),n=JSON.stringify({selection:{points:[],point_indices:[],box:[],lasso:[]}});l!==n&&e.setStringValue(o,n,{fromUi:!0},t)}(m,p,g),e&&setTimeout((()=>{H((e=>({...e,data:e.data.map((e=>({...e,selectedpoints:null}))),layout:{...e.layout,selections:[]}})))}),50)}),[p.id,m,g]);return(0,l.useEffect)((()=>{if(!p.formId||!k)return;const e=new a.o;return e.manageFormClearListener(m,p.formId,B),()=>{e.disconnect()}}),[p.formId,m,k,B]),(0,l.useEffect)((()=>{var e,o,t;if(!k)return;let l;l="select"===(null===(e=P.layout)||void 0===e?void 0:e.dragmode)||"lasso"===(null===(o=P.layout)||void 0===o?void 0:o.dragmode)?"event":E?"event+select":"none",(null===(t=P.layout)||void 0===t?void 0:t.clickmode)!==l&&H((e=>({...e,layout:{...e.layout,clickmode:l}})))}),[null===(s=P.layout)||void 0===s?void 0:s.dragmode]),(0,y.jsx)("div",{className:"stPlotlyChart","data-testid":"stPlotlyChart",children:(0,y.jsx)(i.A,{data:P.data,layout:P.layout,config:_,frames:null!==(c=P.frames)&&void 0!==c?c:void 0,style:{visibility:void 0===(null===(d=P.layout)||void 0===d?void 0:d.width)?"hidden":void 0},onSelected:k?W:()=>{},onDoubleClick:k?()=>B():void 0,onDeselect:k?()=>{B(!1)}:void 0,onInitialized:e=>{m.setElementState(p.id,"figure",e)},onUpdate:e=>{m.setElementState(p.id,"figure",e),H(e)}},w?"fullscreen":"original")})}),!0)},22044:(e,o,t)=>{t.d(o,{A:()=>y});var l=t(58878),n=t(53124),i=t.n(n),r=t(8151),s=t(41514),c=t(67214),a=t(64611),d=t(84152),p=t(89653);const u=(0,p.A)("button",{target:"e1vs0wn31"})((e=>{let{isExpanded:o,theme:t}=e;const l=o?{right:"0.4rem",top:"0.5rem",backgroundColor:"transparent"}:{right:"-3.0rem",top:"-0.375rem",opacity:0,transform:"scale(0)",backgroundColor:t.colors.lightenedBg05};return{position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",zIndex:t.zIndices.sidebar+1,height:"2.5rem",width:"2.5rem",transition:"opacity 300ms 150ms, transform 300ms 150ms",border:"none",color:t.colors.fadedText60,borderRadius:"50%",...l,"&:focus":{outline:"none"},"&:active, &:focus-visible, &:hover":{opacity:1,outline:"none",transform:"scale(1)",color:t.colors.bodyText,transition:"none"}}}),""),h=(0,p.A)("div",{target:"e1vs0wn30"})((e=>{let{theme:o,isExpanded:t}=e;return{"&:hover":{[u]:{opacity:1,transform:"scale(1)",transition:"none"}},...t?{position:"fixed",top:0,left:0,bottom:0,right:0,background:o.colors.bgColor,zIndex:o.zIndices.fullscreenWrapper,padding:o.spacing.md,paddingTop:o.sizes.fullScreenHeaderHeight,overflow:["auto","overlay"],display:"flex",alignItems:"center",justifyContent:"center"}:{}}}),"");var m=t(90782);class f extends l.PureComponent{constructor(e){super(e),this.context=void 0,this.controlKeys=e=>{const{expanded:o}=this.state;27===e.keyCode&&o&&this.zoomOut()},this.zoomIn=()=>{document.body.style.overflow="hidden",this.context.setFullScreen(!0),this.setState({expanded:!0})},this.zoomOut=()=>{document.body.style.overflow="unset",this.context.setFullScreen(!1),this.setState({expanded:!1})},this.convertScssRemValueToPixels=e=>parseFloat(e)*parseFloat(getComputedStyle(document.documentElement).fontSize),this.getWindowDimensions=()=>{const e=this.convertScssRemValueToPixels(this.props.theme.spacing.md),o=this.convertScssRemValueToPixels(this.props.theme.sizes.fullScreenHeaderHeight);return{fullWidth:window.innerWidth-2*e,fullHeight:window.innerHeight-(e+o)}},this.updateWindowDimensions=()=>{this.setState(this.getWindowDimensions())},this.state={expanded:!1,...this.getWindowDimensions()}}componentDidMount(){window.addEventListener("resize",this.updateWindowDimensions),document.addEventListener("keydown",this.controlKeys,!1)}componentWillUnmount(){window.removeEventListener("resize",this.updateWindowDimensions),document.removeEventListener("keydown",this.controlKeys,!1)}render(){const{expanded:e,fullWidth:o,fullHeight:t}=this.state,{children:l,width:n,height:i,disableFullscreenMode:r}=this.props;let d=s.u,p=this.zoomIn,f="View fullscreen";return e&&(d=c.Q,p=this.zoomOut,f="Exit fullscreen"),(0,m.jsxs)(h,{isExpanded:e,"data-testid":"stFullScreenFrame",children:[!r&&(0,m.jsx)(u,{"data-testid":"StyledFullScreenButton",onClick:p,title:f,isExpanded:e,children:(0,m.jsx)(a.A,{content:d})}),l(e?{width:o,height:t,expanded:e,expand:this.zoomIn,collapse:this.zoomOut}:{width:n,height:i,expanded:e,expand:this.zoomIn,collapse:this.zoomOut})]})}}f.contextType=d.n;const g=(0,r.b)(f);const y=function(e){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];class t extends l.PureComponent{constructor(){super(...arguments),this.render=()=>{const{width:t,height:l,disableFullscreenMode:n}=this.props;return(0,m.jsx)(g,{width:t,height:l,disableFullscreenMode:o||n,children:o=>{let{width:t,height:l,expanded:n,expand:i,collapse:r}=o;return(0,m.jsx)(e,{...this.props,width:t,height:l,isFullScreen:n,expand:i,collapse:r})}})}}}return t.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,i()(t,e)}},34752:(e,o,t)=>{t.d(o,{X:()=>r,o:()=>i});var l=t(58878),n=t(25571);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,o,t){(0,n.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===o||(this.disconnect(),(0,n._L)(o)&&(this.formClearListener=e.addFormClearedListener(o,t),this.lastWidgetMgr=e,this.lastFormId=o))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function r(e){let{element:o,widgetMgr:t,onFormCleared:i}=e;(0,l.useEffect)((()=>{if(!(0,n._L)(o.formId))return;const e=t.addFormClearedListener(o.formId,i);return()=>{e.disconnect()}}),[o,t,i])}}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[8815],{34752:(e,t,s)=>{s.d(t,{X:()=>n,o:()=>r});var i=s(58878),o=s(25571);class r{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,s){(0,o.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,o._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,s),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function n(e){let{element:t,widgetMgr:s,onFormCleared:r}=e;(0,i.useEffect)((()=>{if(!(0,o._L)(t.formId))return;const e=s.addFormClearedListener(t.formId,r);return()=>{e.disconnect()}}),[t,s,r])}},48815:(e,t,s)=>{s.r(t),s.d(t,{default:()=>x});var i=s(58878),o=s(2273),r=s(64506),n=s.n(r),l=s(8151),a=s(3680),d=s(4314),h=s(80956),p=s(34752),c=s(70474),m=s(78286);const u=(0,s(89653).A)("div",{target:"e6zijwc0"})((e=>{let{theme:t}=e;return{"span[aria-disabled='true']":{background:t.colors.fadedText05}}}),"");var g=s(93480),v=s(997),f=s(43652),b=s(4871),y=s(25571),S=s(90782);class C extends i.PureComponent{constructor(){super(...arguments),this.formClearHelper=new p.o,this.state={value:this.initialValue},this.commitWidgetValue=e=>{const{widgetMgr:t,element:s,fragmentId:i}=this.props;t.setIntArrayValue(s,this.state.value,e,i)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onChange=e=>{this.props.element.maxSelections&&"select"===e.type&&this.state.value.length>=this.props.element.maxSelections||this.setState(this.generateNewState(e),(()=>{this.commitWidgetValue({fromUi:!0})}))},this.filterOptions=(e,t)=>{if(this.overMaxSelections())return[];const s=e.filter((e=>!this.state.value.includes(Number(e.value))));return(0,b.VC)(s,t)}}overMaxSelections(){return this.props.element.maxSelections>0&&this.state.value.length>=this.props.element.maxSelections}getNoResultsMsg(){const{maxSelections:e}=this.props.element,{value:t}=this.state;if(0===e)return"No results";if(t.length===e){return`You can only select up to ${e} ${1!==e?"options":"option"}. Remove an option first.`}return"No results"}get initialValue(){const e=this.props.widgetMgr.getIntArrayValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}get valueFromState(){return this.state.value.map((e=>{const t=this.props.element.options[e];return{value:e.toString(),label:t}}))}generateNewState(e){const t=()=>{var t;const s=null===(t=e.option)||void 0===t?void 0:t.value;return parseInt(s,10)};switch(e.type){case"remove":return{value:n()(this.state.value,t())};case"clear":return{value:[]};case"select":return{value:this.state.value.concat([t()])};default:throw new Error(`State transition is unknown: ${e.type}`)}}render(){var e;const{element:t,theme:s,width:i,widgetMgr:r}=this.props,n={width:i},{options:l}=t,p=0===l.length||this.props.disabled,b=0===l.length?"No options to select.":t.placeholder,C=l.map(((e,t)=>({label:e,value:t.toString()})));this.formClearHelper.manageFormClearListener(r,t.formId,this.onFormCleared);const x=l.length>10;return(0,S.jsxs)("div",{className:"stMultiSelect","data-testid":"stMultiSelect",style:n,children:[(0,S.jsx)(c.L,{label:t.label,disabled:p,labelVisibility:(0,y.yv)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,S.jsx)(m.j,{children:(0,S.jsx)(g.A,{content:t.help,placement:v.W.TOP_RIGHT})})}),(0,S.jsx)(u,{children:(0,S.jsx)(d.A,{options:C,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:b,type:h.ZE.select,multi:!0,onChange:this.onChange,value:this.valueFromState,disabled:p,size:"compact",noResultsMsg:this.getNoResultsMsg(),filterOptions:this.filterOptions,closeOnSelect:!1,overrides:{SelectArrow:{component:a.A,props:{overrides:{Svg:{style:()=>({width:s.iconSizes.xl,height:s.iconSizes.xl})}}}},IconsContainer:{style:()=>({paddingRight:s.spacing.sm})},ControlContainer:{style:{minHeight:s.sizes.minElementHeight,borderLeftWidth:s.sizes.borderWidth,borderRightWidth:s.sizes.borderWidth,borderTopWidth:s.sizes.borderWidth,borderBottomWidth:s.sizes.borderWidth}},Placeholder:{style:()=>({flex:"inherit",opacity:"0.7"})},ValueContainer:{style:()=>({paddingLeft:s.spacing.sm,paddingTop:s.spacing.none,paddingBottom:s.spacing.none,paddingRight:s.spacing.none})},ClearIcon:{props:{overrides:{Svg:{style:{color:s.colors.darkGray,transform:"scale(1.5)",width:s.spacing.twoXL,":hover":{fill:s.colors.bodyText}}}}}},SearchIcon:{style:{color:s.colors.darkGray}},Tag:{props:{overrides:{Root:{style:{borderTopLeftRadius:s.radii.md,borderTopRightRadius:s.radii.md,borderBottomRightRadius:s.radii.md,borderBottomLeftRadius:s.radii.md,fontSize:s.fontSizes.sm,paddingLeft:s.spacing.sm,marginLeft:s.spacing.none,marginRight:s.spacing.sm,height
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[8815],{34752:(e,t,s)=>{s.d(t,{X:()=>n,o:()=>r});var i=s(58878),o=s(25571);class r{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,s){(0,o.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,o._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,s),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function n(e){let{element:t,widgetMgr:s,onFormCleared:r}=e;(0,i.useEffect)((()=>{if(!(0,o._L)(t.formId))return;const e=s.addFormClearedListener(t.formId,r);return()=>{e.disconnect()}}),[t,s,r])}},48815:(e,t,s)=>{s.r(t),s.d(t,{default:()=>x});var i=s(58878),o=s(2273),r=s(64506),n=s.n(r),l=s(8151),a=s(3680),d=s(4314),h=s(80956),p=s(34752),c=s(70474),m=s(78286);const u=(0,s(89653).A)("div",{target:"e6zijwc0"})((e=>{let{theme:t}=e;return{"span[aria-disabled='true']":{background:t.colors.fadedText05}}}),"");var g=s(93480),v=s(997),f=s(43652),b=s(4871),y=s(25571),S=s(90782);class C extends i.PureComponent{constructor(){super(...arguments),this.formClearHelper=new p.o,this.state={value:this.initialValue},this.commitWidgetValue=e=>{const{widgetMgr:t,element:s,fragmentId:i}=this.props;t.setIntArrayValue(s,this.state.value,e,i)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onChange=e=>{this.props.element.maxSelections&&"select"===e.type&&this.state.value.length>=this.props.element.maxSelections||this.setState(this.generateNewState(e),(()=>{this.commitWidgetValue({fromUi:!0})}))},this.filterOptions=(e,t)=>{if(this.overMaxSelections())return[];const s=e.filter((e=>!this.state.value.includes(Number(e.value))));return(0,b.VC)(s,t)}}overMaxSelections(){return this.props.element.maxSelections>0&&this.state.value.length>=this.props.element.maxSelections}getNoResultsMsg(){const{maxSelections:e}=this.props.element,{value:t}=this.state;if(0===e)return"No results";if(t.length===e){return`You can only select up to ${e} ${1!==e?"options":"option"}. Remove an option first.`}return"No results"}get initialValue(){const e=this.props.widgetMgr.getIntArrayValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}get valueFromState(){return this.state.value.map((e=>{const t=this.props.element.options[e];return{value:e.toString(),label:t}}))}generateNewState(e){const t=()=>{var t;const s=null===(t=e.option)||void 0===t?void 0:t.value;return parseInt(s,10)};switch(e.type){case"remove":return{value:n()(this.state.value,t())};case"clear":return{value:[]};case"select":return{value:this.state.value.concat([t()])};default:throw new Error(`State transition is unknown: ${e.type}`)}}render(){var e;const{element:t,theme:s,width:i,widgetMgr:r}=this.props,n={width:i},{options:l}=t,p=0===l.length||this.props.disabled,b=0===l.length?"No options to select.":t.placeholder,C=l.map(((e,t)=>({label:e,value:t.toString()})));this.formClearHelper.manageFormClearListener(r,t.formId,this.onFormCleared);const x=l.length>10;return(0,S.jsxs)("div",{className:"stMultiSelect","data-testid":"stMultiSelect",style:n,children:[(0,S.jsx)(c.L,{label:t.label,disabled:p,labelVisibility:(0,y.yv)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,S.jsx)(m.j,{children:(0,S.jsx)(g.A,{content:t.help,placement:v.W.TOP_RIGHT})})}),(0,S.jsx)(u,{children:(0,S.jsx)(d.A,{options:C,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:b,type:h.ZE.select,multi:!0,onChange:this.onChange,value:this.valueFromState,disabled:p,size:"compact",noResultsMsg:this.getNoResultsMsg(),filterOptions:this.filterOptions,closeOnSelect:!1,overrides:{SelectArrow:{component:a.A,props:{overrides:{Svg:{style:()=>({width:s.iconSizes.xl,height:s.iconSizes.xl})}}}},IconsContainer:{style:()=>({paddingRight:s.spacing.sm})},ControlContainer:{style:{minHeight:s.sizes.minElementHeight,borderLeftWidth:s.sizes.borderWidth,borderRightWidth:s.sizes.borderWidth,borderTopWidth:s.sizes.borderWidth,borderBottomWidth:s.sizes.borderWidth}},Placeholder:{style:()=>({flex:"inherit",opacity:"0.7"})},ValueContainer:{style:()=>({paddingLeft:s.spacing.sm,paddingTop:s.spacing.none,paddingBottom:s.spacing.none,paddingRight:s.spacing.none})},ClearIcon:{props:{overrides:{Svg:{style:{color:s.colors.darkGray,transform:"scale(1.5)",width:s.spacing.twoXL,":hover":{fill:s.colors.bodyText}}}}}},SearchIcon:{style:{color:s.colors.darkGray}},Tag:{props:{overrides:{Root:{style:{borderTopLeftRadius:s.radii.md,borderTopRightRadius:s.radii.md,borderBottomRightRadius:s.radii.md,borderBottomLeftRadius:s.radii.md,fontSize:s.fontSizes.sm,paddingLeft:s.spacing.sm,marginLeft:s.spacing.none,marginRight:s.spacing.sm,height:`calc(${s.sizes.minElementHeight} - 2 * ${s.spacing.xs})`,maxWidth:`calc(100% - ${s.spacing.lg})`}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"10px",height:"10px"}}}}},Text:{style:{fontSize:s.fontSizes.md}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:s.fontSizes.sm}}}}},Input:{props:{readOnly:o.Fr&&!1===x?"readonly":null}},Dropdown:{component:f.A}}})})]})}}const x=(0,l.b)(C)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[9114],{34752:(e,t,i)=>{i.d(t,{X:()=>o,o:()=>r});var s=i(58878),n=i(25571);class r{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,i){(0,n.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,n._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,i),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function o(e){let{element:t,widgetMgr:i,onFormCleared:r}=e;(0,s.useEffect)((()=>{if(!(0,n._L)(t.formId))return;const e=i.addFormClearedListener(t.formId,r);return()=>{e.disconnect()}}),[t,i,r])}},79114:(e,t,i)=>{i.r(t),i.d(t,{default:()=>F});var s=i(58878),n=i(97757),r=i.n(n),o=i(90847),a=i(8151),l=i(34694),d=i(90491),h=i.n(d),m=i(34752),u=i(29669),c=i(25571),g=i(70474),p=i(78286),f=i(93480),b=i(997),v=i(89653),T=i(32735);const y=(0,v.A)("div",{target:"ew7r33m3"})((e=>{let{disabled:t,theme:i}=e;return{alignItems:"center",backgroundColor:t?i.colors.gray:i.colors.primary,borderTopLeftRadius:"100%",borderTopRightRadius:"100%",borderBottomLeftRadius:"100%",borderBottomRightRadius:"100%",borderTopStyle:"none",borderBottomStyle:"none",borderRightStyle:"none",borderLeftStyle:"none",boxShadow:"none",display:"flex",justifyContent:"center",height:i.sizes.sliderThumb,width:i.sizes.sliderThumb,":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 0.2rem ${(0,T.No)(i.colors.primary,.5)}`}}}),""),R=(0,v.A)("div",{target:"ew7r33m2"})((e=>{let{disabled:t,theme:i}=e;return{fontFamily:i.genericFonts.codeFont,fontSize:i.fontSizes.sm,paddingBottom:i.spacing.twoThirdsSmFont,color:t?i.colors.gray:i.colors.primary,top:"-22px",position:"absolute",whiteSpace:"nowrap",backgroundColor:i.colors.transparent,lineHeight:i.lineHeights.base,fontWeight:"normal"}}),""),C=(0,v.A)("div",{target:"ew7r33m1"})((e=>{let{theme:t}=e;return{paddingBottom:t.spacing.none,paddingLeft:t.spacing.none,paddingRight:t.spacing.none,paddingTop:t.spacing.twoThirdsSmFont,justifyContent:"space-between",alignItems:"center",display:"flex"}}),""),
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[9114],{34752:(e,t,i)=>{i.d(t,{X:()=>o,o:()=>r});var s=i(58878),n=i(25571);class r{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,i){(0,n.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,n._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,i),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function o(e){let{element:t,widgetMgr:i,onFormCleared:r}=e;(0,s.useEffect)((()=>{if(!(0,n._L)(t.formId))return;const e=i.addFormClearedListener(t.formId,r);return()=>{e.disconnect()}}),[t,i,r])}},79114:(e,t,i)=>{i.r(t),i.d(t,{default:()=>F});var s=i(58878),n=i(97757),r=i.n(n),o=i(90847),a=i(8151),l=i(34694),d=i(90491),h=i.n(d),m=i(34752),u=i(29669),c=i(25571),g=i(70474),p=i(78286),f=i(93480),b=i(997),v=i(89653),T=i(32735);const y=(0,v.A)("div",{target:"ew7r33m3"})((e=>{let{disabled:t,theme:i}=e;return{alignItems:"center",backgroundColor:t?i.colors.gray:i.colors.primary,borderTopLeftRadius:"100%",borderTopRightRadius:"100%",borderBottomLeftRadius:"100%",borderBottomRightRadius:"100%",borderTopStyle:"none",borderBottomStyle:"none",borderRightStyle:"none",borderLeftStyle:"none",boxShadow:"none",display:"flex",justifyContent:"center",height:i.sizes.sliderThumb,width:i.sizes.sliderThumb,":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 0.2rem ${(0,T.No)(i.colors.primary,.5)}`}}}),""),R=(0,v.A)("div",{target:"ew7r33m2"})((e=>{let{disabled:t,theme:i}=e;return{fontFamily:i.genericFonts.codeFont,fontSize:i.fontSizes.sm,paddingBottom:i.spacing.twoThirdsSmFont,color:t?i.colors.gray:i.colors.primary,top:"-22px",position:"absolute",whiteSpace:"nowrap",backgroundColor:i.colors.transparent,lineHeight:i.lineHeights.base,fontWeight:"normal"}}),""),C=(0,v.A)("div",{target:"ew7r33m1"})((e=>{let{theme:t}=e;return{paddingBottom:t.spacing.none,paddingLeft:t.spacing.none,paddingRight:t.spacing.none,paddingTop:t.spacing.twoThirdsSmFont,justifyContent:"space-between",alignItems:"center",display:"flex"}}),""),w=(0,v.A)("div",{target:"ew7r33m0"})((e=>{let{disabled:t,theme:i}=e;return{lineHeight:i.lineHeights.base,fontWeight:"normal",fontSize:i.fontSizes.sm,fontFamily:i.genericFonts.codeFont,color:t?i.colors.fadedText40:"inherit"}}),"");var V=i(90782);class x extends s.PureComponent{constructor(e){super(e),this.formClearHelper=new m.o,this.state=void 0,this.sliderRef=s.createRef(),this.thumbRef=[],this.thumbValueRef=[],this.commitWidgetValueDebounced=void 0,this.commitWidgetValue=e=>{const{widgetMgr:t,element:i,fragmentId:s}=this.props;t.setDoubleArrayValue(i,this.state.value,e,s)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.handleChange=e=>{let{value:t}=e;this.setState({value:t},(()=>this.commitWidgetValueDebounced({fromUi:!0})))},this.renderThumb=s.forwardRef(((e,t)=>{const{$value:i,$thumbIndex:n}=e,o=n||0;this.thumbRef[o]=t,this.thumbValueRef[o]||=s.createRef();const a=i?this.formatValue(i[n]):"",l=r()(e,["role","style","aria-valuemax","aria-valuemin","aria-valuenow","tabIndex","onKeyUp","onKeyDown","onMouseEnter","onMouseLeave","draggable"]),d={};return(this.props.element.options.length>0||this.isDateTimeType())&&(d["aria-valuetext"]=a),(0,V.jsx)(y,{...l,disabled:!0===e.$disabled,ref:this.thumbRef[o],"aria-valuetext":a,"aria-label":this.props.element.label,children:(0,V.jsx)(R,{"data-testid":"stSliderThumbValue",disabled:!0===e.$disabled,ref:this.thumbValueRef[o],children:a})})})),this.renderTickBar=()=>{const{disabled:e,element:t}=this.props,{max:i,min:s}=t;return(0,V.jsxs)(C,{"data-testid":"stSliderTickBar",children:[(0,V.jsx)(w,{disabled:e,"data-testid":"stSliderTickBarMin",children:this.formatValue(s)}),(0,V.jsx)(w,{disabled:e,"data-testid":"stSliderTickBarMax",children:this.formatValue(i)})]})},this.commitWidgetValueDebounced=(0,c.sg)(200,this.commitWidgetValue.bind(this)),this.state={value:this.initialValue}}get initialValue(){const e=this.props.widgetMgr.getDoubleArrayValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){setTimeout((()=>{this.thumbValueAlignment()}),0),this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}get value(){const{min:e,max:t}=this.props.element,{value:i}=this.state;let s=i[0],n=i.length>1?i[1]:i[0];return s>n&&(s=n),s<e&&(s=e),s>t&&(s=t),n<e&&(n=e),n>t&&(n=t),i.length>1?[s,n]:[s]}isDateTimeType(){const{dataType:e}=this.props.element;return e===u.Ap.DataType.DATETIME||e===u.Ap.DataType.DATE||e===u.Ap.DataType.TIME}formatValue(e){const{format:t,options:i}=this.props.element;return this.isDateTimeType()?h().utc(e/1e3).format(t):i.length>0?(0,l.sprintf)(t,i[e]):(0,l.sprintf)(t,e)}alignValueOnThumb(e,t,i){if(e&&t&&i){const s=e.getBoundingClientRect(),n=t.getBoundingClientRect(),r=i.getBoundingClientRect(),o=n.left+n.width/2,a=o-r.width/2<s.left,l=o+r.width/2>s.right;i.style.left=a?"0":"",i.style.right=l?"0":""}}thumbValueAlignment(){var e,t,i,s;const n=this.sliderRef.current,r=null===(e=this.thumbRef[0])||void 0===e?void 0:e.current,o=null===(t=this.thumbRef[1])||void 0===t?void 0:t.current,a=null===(i=this.thumbValueRef[0])||void 0===i?void 0:i.current,l=null===(s=this.thumbValueRef[1])||void 0===s?void 0:s.current;if(this.alignValueOnThumb(n,r,a),this.alignValueOnThumb(n,o,l),n&&r&&o&&a&&l){const e=n.getBoundingClientRect(),t=r.getBoundingClientRect(),i=o.getBoundingClientRect(),s=a.getBoundingClientRect(),d=l.getBoundingClientRect();if(s.right+16>d.left){d.left-16-s.width>e.left?a.style.right=d.width+16-(i.right-t.right)+"px":l.style.left=s.width+16-(i.left-t.left)+"px"}}}render(){var e;const{disabled:t,element:i,theme:s,width:n,widgetMgr:r}=this.props,{colors:a,fonts:l,fontSizes:d,spacing:h}=s,m={width:n};return this.formClearHelper.manageFormClearListener(r,i.formId,this.onFormCleared),this.thumbValueAlignment(),(0,V.jsxs)("div",{ref:this.sliderRef,className:"stSlider","data-testid":"stSlider",style:m,children:[(0,V.jsx)(g.L,{label:i.label,disabled:t,labelVisibility:(0,c.yv)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,V.jsx)(p.j,{children:(0,V.jsx)(f.A,{content:i.help,placement:b.W.TOP_RIGHT})})}),(0,V.jsx)(o.A,{min:i.min,max:i.max,step:i.step,value:this.value,onChange:this.handleChange,disabled:t,overrides:{Root:{style:{paddingTop:h.twoThirdsSmFont}},Thumb:this.renderThumb,Tick:{style:{fontFamily:l.monospace,fontSize:d.sm}},Track:{style:{backgroundColor:"none !important",paddingBottom:h.none,paddingLeft:h.none,paddingRight:h.none,paddingTop:h.twoThirdsSmFont}},InnerTrack:{style:e=>{let{$disabled:t}=e;return{height:h.twoXS,...t?{background:a.darkenedBgMix25}:{}}}},TickBar:this.renderTickBar}})]})}}const F=(0,a.b)(x)}}]);
|
@@ -0,0 +1,5 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[954],{68035:(e,t,r)=>{r.d(t,{A:()=>d});r(58878);var o=r(25571),i=r(78286),l=r(89653);const n=r(60667).i7`
|
2
|
+
50% {
|
3
|
+
color: rgba(0, 0, 0, 0);
|
4
|
+
}
|
5
|
+
`,a=(0,l.A)("span",{target:"edlqvik0"})((e=>{let{includeDot:t,shouldBlink:r,theme:o}=e;return{...t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:o.colors.gray,margin:`0 ${o.spacing.twoXS}`}}:{},...r?{color:o.colors.red,animationName:`${n}`,animationDuration:"0.5s",animationIterationCount:5}:{}}}),"");var s=r(90782);const d=e=>{let{dirty:t,value:r,inForm:l,maxLength:n,className:d,type:u="single",allowEnterToSubmit:c=!0}=e;const p=[],m=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];p.push((0,s.jsx)(a,{includeDot:p.length>0,shouldBlink:t,children:e},p.length))};if(c){const e=l?"submit form":"apply";if("multiline"===u){m(`Press ${(0,o.u_)()?"\u2318":"Ctrl"}+Enter to ${e}`)}else"single"===u&&m(`Press Enter to ${e}`)}return n&&("chat"!==u||t)&&m(`${r.length}/${n}`,t&&r.length>=n),(0,s.jsx)(i.tp,{"data-testid":"InputInstructions",className:d,children:p})}},34752:(e,t,r)=>{r.d(t,{X:()=>n,o:()=>l});var o=r(58878),i=r(25571);class l{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){(0,i.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,i._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function n(e){let{element:t,widgetMgr:r,onFormCleared:l}=e;(0,o.useEffect)((()=>{if(!(0,i._L)(t.formId))return;const e=r.addFormClearedListener(t.formId,l);return()=>{e.disconnect()}}),[t,r,l])}},10954:(e,t,r)=>{r.r(t),r.d(t,{default:()=>j});var o=r(58878),i=r(27774),l=r(94388),n=r(8151),a=r(34694),s=r(59095),d=r(32698),u=r.n(d),c=r(25571),p=r(34752),m=r(84996),h=r(29669),g=r(93480),b=r(997),f=r(64611),v=r(68035),y=r(70474),w=r(78286),I=r(89653);const C=(0,I.A)("div",{target:"e116k4er3"})((e=>{let{theme:t}=e;return{display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:t.sizes.minElementHeight,borderWidth:t.sizes.borderWidth,borderStyle:"solid",borderColor:t.colors.widgetBorderColor||t.colors.widgetBackgroundColor||t.colors.bgColor,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:t.radii.default,overflow:"hidden","&.focused":{borderColor:t.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:t.spacing.none}}}}),""),T=(0,I.A)("div",{target:"e116k4er2"})({name:"76z9jo",styles:"display:flex;flex-direction:row;align-self:stretch"}),x=(0,I.A)("button",{target:"e116k4er1"})((e=>{let{theme:t}=e;return{margin:t.spacing.none,border:"none",height:t.sizes.full,display:"flex",alignItems:"center",width:"32px",justifyContent:"center",color:t.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:t.colors.widgetBackgroundColor||t.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:t.colors.white,backgroundColor:t.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:last-of-type":{borderTopRightRadius:t.radii.default,borderBottomRightRadius:t.radii.default},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}}}),""),k=(0,I.A)("div",{target:"e116k4er0"})((e=>{let{theme:t,clearable:r}=e;return{position:"absolute",marginRight:t.spacing.twoXS,left:0,right:64+(r?12:0)+"px"}}),"");var F=r(90782);const R=e=>{let{step:t,dataType:r}=e;return t||(r===h.Q7.DataType.INT?1:.01)},D=e=>{let{value:t,format:r,step:o,dataType:i}=e;if((0,c.hX)(t))return null;let l=function(e){return(0,c.hX)(e)||""===e?void 0:e}(r);if((0,c.hX)(l)&&(0,c.se)(o)){const e=o.toString();if(i===h.Q7.DataType.FLOAT&&0!==o&&e.includes(".")){l=`%0.${e.split(".")[1].length}f`}}if((0,c.hX)(l))return t.toString();try{return(0,a.sprintf)(l,t)}catch(n){return(0,m.FF)(`Error in sprintf(${l}, ${t}): ${n}`),String(t)}},j=(0,n.b)((e=>{var t;let{disabled:r,element:n,widgetMgr:a,width:d,theme:m,fragmentId:I}=e;const{dataType:j,id:L,formId:S,default:A,format:N}=n,W=n.hasMin?n.min:-1/0,E=n.hasMax?n.max:1/0,[M,B]=o.useState(R(n)),X=(e=>{var t;const r=e.element.dataType===h.Q7.DataType.INT?e.widgetMgr.getIntValue(e.element):e.widgetMgr.getDoubleValue(e.element);return null!==(t=null!==r&&void 0!==r?r:e.element.default)&&void 0!==t?t:null})({element:n,widgetMgr:a}),[$,V]=o.useState(!1),[_,U]=o.useState(X),[z,Q]=o.useState(D({value:X,...n,step:M})),[H,P]=o.useState(!1),O=o.useRef(null),G=o.useRef(new p.o),K=o.useRef(u()("number_input_")),q=((e,t,r)=>!(0,c.hX)(e)&&e-t>=r)(_,M,W),J=((e,t,r)=>!(0,c.hX)(e)&&e+t<=r)(_,M,E),Y=(0,c.Ml)({formId:S}),Z=Y?a.allowFormEnterToSubmit(S):$,ee=H&&d>m.breakpoints.hideWidgetDetails;o.useEffect((()=>{B(R({step:n.step,dataType:n.dataType}))}),[n.dataType,n.step]);const te=o.useCallback((e=>{let{value:t,source:r}=e;if((0,c.se)(t)&&(W>t||t>E)){var o;null===(o=O.current)||void 0===o||o.reportValidity()}else{var i;const e=null!==(i=null!==t&&void 0!==t?t:A)&&void 0!==i?i:null;switch(j){case h.Q7.DataType.INT:a.setIntValue({id:L,formId:S},e,r,I);break;case h.Q7.DataType.FLOAT:a.setDoubleValue({id:L,formId:S},e,r,I);break;default:throw new Error("Invalid data type")}V(!1),U(e),Q(D({value:e,dataType:j,format:N,step:M}))}}),[W,E,O,a,I,M,j,L,S,A,N]),re=()=>{const{value:e}=n;n.setValue=!1,U(null!==e&&void 0!==e?e:null),Q(D({value:null!==e&&void 0!==e?e:null,...n,step:M})),te({value:null!==e&&void 0!==e?e:null,source:{fromUi:!1}})};o.useEffect((()=>{const e=G.current;return n.setValue?re():te({value:_,source:{fromUi:!1}}),()=>{e.disconnect()}}),[]),n.setValue&&re();const oe=(0,c.hX)(n.default)&&!r;G.current.manageFormClearListener(a,n.formId,(()=>{var e;U(null!==(e=n.default)&&void 0!==e?e:null),te({value:_,source:{fromUi:!0}})}));const ie=o.useCallback((()=>{J&&(V(!0),te({value:(null!==_&&void 0!==_?_:W)+M,source:{fromUi:!0}}))}),[_,W,M,J]),le=o.useCallback((()=>{q&&(V(!0),te({value:(null!==_&&void 0!==_?_:E)-M,source:{fromUi:!0}}))}),[_,E,M,q]),ne=o.useCallback((e=>{const{key:t}=e;switch(t){case"ArrowUp":e.preventDefault(),ie();break;case"ArrowDown":e.preventDefault(),le()}}),[ie,le]),ae=o.useCallback((e=>{"Enter"===e.key&&($&&te({value:_,source:{fromUi:!0}}),a.allowFormEnterToSubmit(S)&&a.submitForm(S,I))}),[$,_,te,a,S,I]);return(0,F.jsxs)("div",{className:"stNumberInput","data-testid":"stNumberInput",style:{width:d},children:[(0,F.jsx)(y.L,{label:n.label,disabled:r,labelVisibility:(0,c.yv)(null===(t=n.labelVisibility)||void 0===t?void 0:t.value),htmlFor:K.current,children:n.help&&(0,F.jsx)(w.j,{children:(0,F.jsx)(g.A,{content:n.help,placement:b.W.TOP_RIGHT})})}),(0,F.jsxs)(C,{className:H?"focused":"","data-testid":"stNumberInputContainer",children:[(0,F.jsx)(s.A,{type:"number",inputRef:O,value:null!==z&&void 0!==z?z:"",placeholder:n.placeholder,onBlur:()=>($&&te({value:_,source:{fromUi:!0}}),void P(!1)),onFocus:()=>{P(!0)},onChange:e=>(e=>{const{value:t}=e.target;if(""===t)V(!0),U(null),Q(null);else{let e;e=n.dataType===h.Q7.DataType.INT?parseInt(t,10):parseFloat(t),V(!0),U(e),Q(t)}})(e),onKeyPress:e=>ae(e),onKeyDown:e=>ne(e),clearable:oe,clearOnEscape:oe,disabled:r,"aria-label":n.label,id:K.current,overrides:{ClearIcon:{props:{overrides:{Svg:{style:{color:m.colors.darkGray,transform:"scale(1.4)",width:m.spacing.twoXL,marginRight:"-1.25em",":hover":{fill:m.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:M,min:W,max:E},style:{lineHeight:m.lineHeights.inputWidget,paddingRight:m.spacing.sm,paddingLeft:m.spacing.sm,paddingBottom:m.spacing.sm,paddingTop:m.spacing.sm}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0})}}}),d>m.breakpoints.hideNumberInputControls&&(0,F.jsxs)(T,{children:[(0,F.jsx)(x,{"data-testid":"stNumberInputStepDown",onClick:le,disabled:!q||r,tabIndex:-1,children:(0,F.jsx)(f.A,{content:i.H,size:"xs",color:q?"inherit":"disabled"})}),(0,F.jsx)(x,{"data-testid":"stNumberInputStepUp",onClick:ie,disabled:!J||r,tabIndex:-1,children:(0,F.jsx)(f.A,{content:l.F,size:"xs",color:J?"inherit":"disabled"})})]})]}),ee&&(0,F.jsx)(k,{clearable:oe,children:(0,F.jsx)(v.A,{dirty:$,value:null!==z&&void 0!==z?z:"",inForm:Y,allowEnterToSubmit:Z})})]})}))}}]);
|