streamlit-nightly 1.39.1.dev20241006__py2.py3-none-any.whl → 1.39.1.dev20241008__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/elements/code.py +34 -9
- streamlit/elements/text.py +11 -2
- streamlit/static/asset-manifest.json +16 -17
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/1780.e9cf7cb1.chunk.js +1 -0
- streamlit/static/static/js/{245.f99079b1.chunk.js → 245.1eea9c21.chunk.js} +1 -1
- streamlit/static/static/js/{3710.b80be2b0.chunk.js → 3710.5f974086.chunk.js} +1 -1
- streamlit/static/static/js/5281.10678439.chunk.js +1 -0
- streamlit/static/static/js/5618.83c6b184.chunk.js +5 -0
- streamlit/static/static/js/{5625.d9509933.chunk.js → 5625.c56e64cd.chunk.js} +1 -1
- streamlit/static/static/js/{6088.1164e19b.chunk.js → 6088.125b23a1.chunk.js} +1 -1
- streamlit/static/static/js/7193.629fc6fe.chunk.js +1 -0
- streamlit/static/static/js/8148.0afeecaa.chunk.js +1 -0
- streamlit/static/static/js/{8166.9447a253.chunk.js → 8166.094f1288.chunk.js} +1 -1
- streamlit/static/static/js/8460.7719d604.chunk.js +1 -0
- streamlit/static/static/js/8815.288881c5.chunk.js +1 -0
- streamlit/static/static/js/9114.ad95241a.chunk.js +1 -0
- streamlit/static/static/js/{9943.6af344bb.chunk.js → 9943.fc19b785.chunk.js} +1 -1
- streamlit/static/static/js/main.b82d9912.js +28 -0
- {streamlit_nightly-1.39.1.dev20241006.dist-info → streamlit_nightly-1.39.1.dev20241008.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.39.1.dev20241006.dist-info → streamlit_nightly-1.39.1.dev20241008.dist-info}/RECORD +26 -27
- streamlit/static/static/css/5711.a29b5d98.chunk.css +0 -1
- streamlit/static/static/js/1780.d7a92d2b.chunk.js +0 -1
- streamlit/static/static/js/5281.02b3ddc4.chunk.js +0 -1
- streamlit/static/static/js/5618.34479f59.chunk.js +0 -5
- streamlit/static/static/js/5711.ad171f9d.chunk.js +0 -1
- streamlit/static/static/js/7193.7582e347.chunk.js +0 -1
- streamlit/static/static/js/8148.f51df66c.chunk.js +0 -1
- streamlit/static/static/js/8815.ef4be53c.chunk.js +0 -1
- streamlit/static/static/js/9114.c234641e.chunk.js +0 -1
- streamlit/static/static/js/main.fb185886.js +0 -28
- /streamlit/static/static/js/{main.fb185886.js.LICENSE.txt → main.b82d9912.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.39.1.dev20241006.data → streamlit_nightly-1.39.1.dev20241008.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.39.1.dev20241006.dist-info → streamlit_nightly-1.39.1.dev20241008.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.39.1.dev20241006.dist-info → streamlit_nightly-1.39.1.dev20241008.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.39.1.dev20241006.dist-info → streamlit_nightly-1.39.1.dev20241008.dist-info}/top_level.txt +0 -0
streamlit/elements/code.py
CHANGED
@@ -40,32 +40,57 @@ class CodeMixin:
|
|
40
40
|
Parameters
|
41
41
|
----------
|
42
42
|
body : str
|
43
|
-
The string to display as code.
|
43
|
+
The string to display as code or monospace text.
|
44
44
|
|
45
45
|
language : str or None
|
46
46
|
The language that the code is written in, for syntax highlighting.
|
47
|
-
If ``None``, the code will
|
47
|
+
This defaults to ``"python"``. If this is ``None``, the code will
|
48
|
+
be plain, monospace text.
|
48
49
|
|
49
|
-
For a list of available ``language`` values, see
|
50
|
-
|
51
|
-
https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_LANGUAGES_PRISM.MD
|
50
|
+
For a list of available ``language`` values, see
|
51
|
+
`react-syntax-highlighter
|
52
|
+
<https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_LANGUAGES_PRISM.MD>`_
|
53
|
+
on GitHub.
|
52
54
|
|
53
55
|
line_numbers : bool
|
54
56
|
An optional boolean indicating whether to show line numbers to the
|
55
|
-
left of the code block.
|
57
|
+
left of the code block. This defaults to ``False``.
|
56
58
|
|
57
59
|
wrap_lines : bool
|
58
|
-
An optional boolean indicating whether to wrap lines.
|
60
|
+
An optional boolean indicating whether to wrap lines. This defaults
|
59
61
|
to ``False``.
|
60
62
|
|
61
|
-
|
62
|
-
|
63
|
+
Examples
|
64
|
+
--------
|
63
65
|
>>> import streamlit as st
|
64
66
|
>>>
|
65
67
|
>>> code = '''def hello():
|
66
68
|
... print("Hello, Streamlit!")'''
|
67
69
|
>>> st.code(code, language="python")
|
68
70
|
|
71
|
+
.. output ::
|
72
|
+
https://doc-code.streamlit.app/
|
73
|
+
height: 220px
|
74
|
+
|
75
|
+
>>> import streamlit as st
|
76
|
+
>>> code = '''Is it a crown or boat?
|
77
|
+
... ii
|
78
|
+
... iiiiii
|
79
|
+
... WWw .iiiiiiii. ...:
|
80
|
+
... WWWWWWw .iiiiiiiiiiii. ........
|
81
|
+
... WWWWWWWWWWw iiiiiiiiiiiiiiii ...........
|
82
|
+
... WWWWWWWWWWWWWWwiiiiiiiiiiiiiiiii............
|
83
|
+
... WWWWWWWWWWWWWWWWWWwiiiiiiiiiiiiii.........
|
84
|
+
... WWWWWWWWWWWWWWWWWWWWWWwiiiiiiiiii.......
|
85
|
+
... WWWWWWWWWWWWWWWWWWWWWWWWWWwiiiiiii....
|
86
|
+
... WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWwiiii.
|
87
|
+
... -MMMWWWWWWWWWWWWWWWWWWWWWWMMM-
|
88
|
+
... '''
|
89
|
+
>>> st.code(code, language=None)
|
90
|
+
|
91
|
+
.. output ::
|
92
|
+
https://doc-code-ascii.streamlit.app/
|
93
|
+
height: 380px
|
69
94
|
"""
|
70
95
|
code_proto = CodeProto()
|
71
96
|
code_proto.code_text = clean_text(body)
|
streamlit/elements/text.py
CHANGED
@@ -33,7 +33,12 @@ class TextMixin:
|
|
33
33
|
*, # keyword-only arguments:
|
34
34
|
help: str | None = None,
|
35
35
|
) -> DeltaGenerator:
|
36
|
-
"""Write
|
36
|
+
"""Write text without Markdown or HTML parsing.
|
37
|
+
|
38
|
+
For monospace text, use |st.code|_.
|
39
|
+
|
40
|
+
.. |st.code| replace:: ``st.code``
|
41
|
+
.. _st.code: https://docs.streamlit.io/develop/api-reference/text/st.code
|
37
42
|
|
38
43
|
Parameters
|
39
44
|
----------
|
@@ -47,7 +52,11 @@ class TextMixin:
|
|
47
52
|
-------
|
48
53
|
>>> import streamlit as st
|
49
54
|
>>>
|
50
|
-
>>> st.text("This is
|
55
|
+
>>> st.text("This is text/n[and more text](that's not a Markdown link).")
|
56
|
+
|
57
|
+
.. output ::
|
58
|
+
https://doc-text.streamlit.app/
|
59
|
+
height: 220px
|
51
60
|
|
52
61
|
"""
|
53
62
|
text_proto = TextProto()
|
@@ -1,43 +1,42 @@
|
|
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.b82d9912.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",
|
8
8
|
"static/js/3391.663b9d47.chunk.js": "./static/js/3391.663b9d47.chunk.js",
|
9
9
|
"static/css/9943.93909c7e.chunk.css": "./static/css/9943.93909c7e.chunk.css",
|
10
|
-
"static/js/9943.
|
11
|
-
"static/
|
12
|
-
"static/js/5711.ad171f9d.chunk.js": "./static/js/5711.ad171f9d.chunk.js",
|
10
|
+
"static/js/9943.fc19b785.chunk.js": "./static/js/9943.fc19b785.chunk.js",
|
11
|
+
"static/js/8460.7719d604.chunk.js": "./static/js/8460.7719d604.chunk.js",
|
13
12
|
"static/js/3861.5aea56b8.chunk.js": "./static/js/3861.5aea56b8.chunk.js",
|
14
13
|
"static/js/8642.58110d15.chunk.js": "./static/js/8642.58110d15.chunk.js",
|
15
|
-
"static/js/3710.
|
16
|
-
"static/js/8148.
|
14
|
+
"static/js/3710.5f974086.chunk.js": "./static/js/3710.5f974086.chunk.js",
|
15
|
+
"static/js/8148.0afeecaa.chunk.js": "./static/js/8148.0afeecaa.chunk.js",
|
17
16
|
"static/js/84.414fa87b.chunk.js": "./static/js/84.414fa87b.chunk.js",
|
18
17
|
"static/js/9923.790a85e7.chunk.js": "./static/js/9923.790a85e7.chunk.js",
|
19
18
|
"static/js/583.61ac7fde.chunk.js": "./static/js/583.61ac7fde.chunk.js",
|
20
19
|
"static/js/4827.f9cb5fa3.chunk.js": "./static/js/4827.f9cb5fa3.chunk.js",
|
21
20
|
"static/js/8237.b58252d4.chunk.js": "./static/js/8237.b58252d4.chunk.js",
|
22
21
|
"static/js/5828.f8572ba4.chunk.js": "./static/js/5828.f8572ba4.chunk.js",
|
23
|
-
"static/js/1780.
|
22
|
+
"static/js/1780.e9cf7cb1.chunk.js": "./static/js/1780.e9cf7cb1.chunk.js",
|
24
23
|
"static/js/9060.1ec8dc2b.chunk.js": "./static/js/9060.1ec8dc2b.chunk.js",
|
25
|
-
"static/js/5625.
|
24
|
+
"static/js/5625.c56e64cd.chunk.js": "./static/js/5625.c56e64cd.chunk.js",
|
26
25
|
"static/js/6141.43a8fda3.chunk.js": "./static/js/6141.43a8fda3.chunk.js",
|
27
26
|
"static/js/4103.374d188d.chunk.js": "./static/js/4103.374d188d.chunk.js",
|
28
27
|
"static/js/1086.9d39d6cd.chunk.js": "./static/js/1086.9d39d6cd.chunk.js",
|
29
|
-
"static/js/245.
|
30
|
-
"static/js/7193.
|
28
|
+
"static/js/245.1eea9c21.chunk.js": "./static/js/245.1eea9c21.chunk.js",
|
29
|
+
"static/js/7193.629fc6fe.chunk.js": "./static/js/7193.629fc6fe.chunk.js",
|
31
30
|
"static/js/6360.6d7cfa35.chunk.js": "./static/js/6360.6d7cfa35.chunk.js",
|
32
31
|
"static/js/8790.0b98f286.chunk.js": "./static/js/8790.0b98f286.chunk.js",
|
33
|
-
"static/js/8815.
|
32
|
+
"static/js/8815.288881c5.chunk.js": "./static/js/8815.288881c5.chunk.js",
|
34
33
|
"static/js/9528.746f7a0e.chunk.js": "./static/js/9528.746f7a0e.chunk.js",
|
35
34
|
"static/js/7809.304e2c99.chunk.js": "./static/js/7809.304e2c99.chunk.js",
|
36
|
-
"static/js/6088.
|
37
|
-
"static/js/8166.
|
38
|
-
"static/js/9114.
|
39
|
-
"static/js/5281.
|
40
|
-
"static/js/5618.
|
35
|
+
"static/js/6088.125b23a1.chunk.js": "./static/js/6088.125b23a1.chunk.js",
|
36
|
+
"static/js/8166.094f1288.chunk.js": "./static/js/8166.094f1288.chunk.js",
|
37
|
+
"static/js/9114.ad95241a.chunk.js": "./static/js/9114.ad95241a.chunk.js",
|
38
|
+
"static/js/5281.10678439.chunk.js": "./static/js/5281.10678439.chunk.js",
|
39
|
+
"static/js/5618.83c6b184.chunk.js": "./static/js/5618.83c6b184.chunk.js",
|
41
40
|
"static/js/1260.dc193a5e.chunk.js": "./static/js/1260.dc193a5e.chunk.js",
|
42
41
|
"static/js/3560.ce031236.chunk.js": "./static/js/3560.ce031236.chunk.js",
|
43
42
|
"static/js/954.ce49a8cf.chunk.js": "./static/js/954.ce49a8cf.chunk.js",
|
@@ -156,6 +155,6 @@
|
|
156
155
|
},
|
157
156
|
"entrypoints": [
|
158
157
|
"static/css/main.5513bd04.css",
|
159
|
-
"static/js/main.
|
158
|
+
"static/js/main.b82d9912.js"
|
160
159
|
]
|
161
160
|
}
|
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.b82d9912.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 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[1780],{85850:(e,t,r)=>{r.d(t,{K:()=>b,A:()=>y});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",f=(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}}}}}),""),h=(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 b(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 y=e=>{let{onExpand:t,onCollapse:r,isFullScreen:n,locked:a,children:l,target:s,disableFullscreenMode:d}=e;return(0,m.jsx)(f,{className:"stElementToolbar","data-testid":"stElementToolbar",locked:a||n,target:s,children:(0,m.jsxs)(h,{children:[l,t&&!d&&!n&&(0,m.jsx)(b,{label:"Fullscreen",icon:i.g,onClick:()=>t()}),r&&!d&&n&&(0,m.jsx)(b,{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),f=r(50609),h=r.n(f),m=r(29669),b=r(67253);var y=r(93480),v=r(997),x=r(70474),C=r(35526);const w=e=>{var t;let{widgetMgr:r,id:i,formId:o,key:a,defaultValue:l}=e;(0,n.useEffect)((()=>{const e=r.getElementState(i,a);(0,g.hX)(e)&&(0,g.se)(l)&&r.setElementState(i,a,l)}),[r,i,a,l]);const[s,d]=(0,n.useState)(null!==(t=r.getElementState(i,a))&&void 0!==t?t:l),u=(0,n.useCallback)((e=>{r.setElementState(i,a,e),d(e)}),[r,i,a]),p=(0,n.useMemo)((()=>({formId:o||""})),[o]),f=(0,n.useCallback)((()=>u(l)),[l,u]);return(0,c.X)({element:p,widgetMgr:r,onFormCleared:f}),[s,u]};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}}),""),X=(0,j.A)("div",{target:"e12wn80j1"})((e=>{let{theme:t}=e;return{marginLeft:t.spacing.sm}}),""),O=(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 V=r(39095),D=r(90782);const $=()=>(0,D.jsxs)(L,{children:[(0,D.jsx)(E,{children:"This app would like to use your microphone."})," ",(0,D.jsx)(F,{href:V.ML,children:"Learn how to allow access."})]}),_=()=>(0,D.jsx)(T,{children:(0,D.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,D.jsx)(Y.Ay,{kind:J.KX.BORDERLESS_ICON,onClick:t,disabled:r,"aria-label":n,fluidWidth:!0,"data-testid":"stAudioInputActionButton",children:(0,D.jsx)(ee.A,{content:i,size:"lg",color:"inherit"})})},re=e=>{let{disabled:t,stopRecording:r}=e;return(0,D.jsx)(P,{children:(0,D.jsx)(te,{onClick:r,disabled:t,ariaLabel:"Stop recording",iconContent:K.X})})},ne=e=>{let{disabled:t,isPlaying:r,onClickPlayPause:n}=e;return(0,D.jsx)(W,{children:r?(0,D.jsx)(te,{onClick:n,disabled:t,ariaLabel:"Pause",iconContent:q.v}):(0,D.jsx)(te,{onClick:n,disabled:t,ariaLabel:"Play",iconContent:Z.S})})},ie=e=>{let{disabled:t,startRecording:r}=e;return(0,D.jsx)(z,{children:(0,D.jsx)(te,{onClick:r,disabled:t,ariaLabel:"Record",iconContent:G.G})})},oe=e=>{let{onClick:t}=e;return(0,D.jsx)(W,{children:(0,D.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,D.jsx)(B,{children:(0,D.jsx)(oe,{onClick:c})}):i?(0,D.jsx)(B,{children:(0,D.jsx)(O,{"aria-label":"Uploading"})}):(0,D.jsxs)(B,{children:[r?(0,D.jsx)(re,{disabled:t,stopRecording:s}):(0,D.jsx)(ie,{disabled:t,startRecording:l}),a&&(0,D.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,D.jsx)(L,{children:(0,D.jsx)(E,{children:"An error has occurred, please try again."})}),ge=e=>{var t;let{element:r,uploadClient:s,widgetMgr:f,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:f,id:r.id,key:"deleteFileUrl",defaultValue:null}),[W,B]=(0,n.useState)(null),[O,V]=(0,n.useState)([]),[G,K]=(0,n.useState)(null),[q,Z]=w({widgetMgr:f,id:r.id,key:"recordingUrl",defaultValue:null}),[,Q]=(0,n.useState)(0),Y=()=>{Q((e=>e+1))},[J,ee]=(0,n.useState)(H),[te,re]=w({widgetMgr:f,id:r.id,formId:r.formId,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),[fe,he]=(0,n.useState)(!1),me=r.id,be=r.formId,ye=(0,n.useCallback)((async e=>{let t;if(pe(!0),(0,g.se)(be)&&f.setFormsWithUploadsInProgress(new Set([be])),t="audio/wav"===e.type?e:await ce(e),!t)return void he(!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,b.$)(c)})))}}const l=h()(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,b.$)(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:f,widgetInfo:{id:me,formId:be},fragmentId:j}).then((e=>{let{successfulUploads:t,failedUploads:r}=e;if(r.length>0)return void he(!0);const n=t[0];n&&n.fileUrl.deleteUrl&&z(n.fileUrl.deleteUrl)})).finally((()=>{(0,g.se)(be)&&f.setFormsWithUploadsInProgress(new Set),pe(!1)}))}),[Z,s,f,me,be,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&&f.setFileUploaderStateValue(r,{},{fromUi:!0},j),ie(!1),(0,g.se)(q)&&URL.revokeObjectURL(q))}),[P,q,s,F,r,f,j,re,Z,z]);(0,n.useEffect)((()=>{if((0,g.hX)(be))return;const e=new c.o;return e.manageFormClearListener(f,be,(()=>{ve({updateWidgetManager:!0})})),()=>e.disconnect()}),[be,ve,f]);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=>{ye(e)})),t.on("record-progress",(e=>{re(N(e))})),T(e),B(t),()=>{e&&e.destroy(),t&&t.destroy()}}),[ye]);(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(V(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||fe,Re=k||oe;return(0,D.jsxs)(A,{className:"stAudioInput","data-testid":"stAudioInput",children:[(0,D.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,D.jsx)(X,{children:(0,D.jsx)(y.A,{content:r.help,placement:v.W.TOP})})}),(0,D.jsxs)(S,{children:[(0,D.jsx)(u.A,{isFullScreen:!1,disableFullscreenMode:!0,target:S,children:P&&(0,D.jsx)(u.K,{label:"Clear recording",icon:l.e,onClick:()=>ve({updateWidgetManager:!0}),"data-testid":"stAudioInputClearRecordingButton"})}),(0,D.jsx)(le,{isRecording:ke,isPlaying:Ae,isUploading:ge,isError:fe,recordingUrlExists:Boolean(q),startRecording:we,stopRecording:je,onClickPlayPause:Ce,onClear:()=>{ve({updateWidgetManager:!1}),he(!1)},disabled:Re}),(0,D.jsxs)(I,{children:[fe&&(0,D.jsx)(ue,{}),Ie&&(0,D.jsx)(_,{}),oe&&(0,D.jsx)($,{}),(0,D.jsx)(U,{"data-testid":"stAudioInputWaveSurfer",ref:M,show:!Ue})]}),(0,D.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}}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[245],{245:(e,t,r)=>{r.r(t),r.d(t,{default:()=>G});var o=r(58878),i=r(8151),n=r(35331),a=r(57224);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return 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}function d(e){var t=e.$disabled,r=e.$checked,o=e.$isIndeterminate,i=e.$error,n=e.$isHovered,a=e.$isActive,l=e.$theme.colors;return t?r||o?l.tickFillDisabled:l.tickFill:i&&(o||r)?a?l.tickFillErrorSelectedHoverActive:n?l.tickFillErrorSelectedHover:l.tickFillErrorSelected:i?a?l.tickFillErrorHoverActive:n?l.tickFillErrorHover:l.tickFillError:o||r?a?l.tickFillSelectedHoverActive:n?l.tickFillSelectedHover:l.tickFillSelected:a?l.tickFillActive:n?l.tickFillHover:l.tickFill}function u(e){var t=e.$disabled,r=e.$theme.colors;return t?r.contentSecondary:r.contentPrimary}var g=(0,a.I4)("label",(function(e){var t=e.$disabled,r=e.$labelPlacement;return{flexDirection:"top"===r||"bottom"===r?"column":"row",display:"flex",alignItems:"top"===r||"bottom"===r?"center":"flex-start",cursor:t?"not-allowed":"pointer",userSelect:"none"}}));g.displayName="Root",g.displayName="Root";var p=(0,a.I4)("span",(function(e){var t=e.$checked,r=e.$disabled,o=e.$error,i=e.$isIndeterminate,n=e.$theme,a=e.$isFocusVisible,l=n.sizing,c=n.animation,s=r?n.colors.tickMarkFillDisabled:o?n.colors.tickMarkFillError:n.colors.tickMarkFill,u=encodeURIComponent('\n <svg width="14" height="4" viewBox="0 0 14 4" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M14 0.5H0V3.5H14V0.5Z" fill="'.concat(s,'"/>\n </svg>\n ')),g=encodeURIComponent('\n <svg width="17" height="13" viewBox="0 0 17 13" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M6.50002 12.6L0.400024 6.60002L2.60002 4.40002L6.50002 8.40002L13.9 0.900024L16.1 3.10002L6.50002 12.6Z" fill="'.concat(s,'"/>\n </svg>\n ')),p=n.borders.checkboxBorderRadius,h=function(e){var t=e.$disabled,r=e.$checked,o=e.$error,i=e.$isIndeterminate,n=e.$theme,a=e.$isFocusVisible,l=n.colors;return t?l.tickFillDisabled:r||i?"transparent":o?l.borderNegative:a?l.borderSelected:l.tickBorder}(e);return{flex:"0 0 auto",transitionDuration:c.timing200,transitionTimingFunction:c.easeOutCurve,transitionProperty:"background-image, border-color, background-color",width:l.scale700,height:l.scale700,left:"4px",top:"4px",boxSizing:"border-box",borderLeftStyle:"solid",borderRightStyle:"solid",borderTopStyle:"solid",borderBottomStyle:"solid",borderLeftWidth:"3px",borderRightWidth:"3px",borderTopWidth:"3px",borderBottomWidth:"3px",borderLeftColor:h,borderRightColor:h,borderTopColor:h,borderBottomColor:h,borderTopLeftRadius:p,borderTopRightRadius:p,borderBottomRightRadius:p,borderBottomLeftRadius:p,outline:a&&t?"3px solid ".concat(n.colors.accent):"none",display:"inline-block",verticalAlign:"middle",backgroundImage:i?"url('data:image/svg+xml,".concat(u,"');"):t?"url('data:image/svg+xml,".concat(g,"');"):null,backgroundColor:d(e),backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"contain",marginTop:n.sizing.scale0,marginBottom:n.sizing.scale0,marginLeft:n.sizing.scale0,marginRight:n.sizing.scale0}}));p.displayName="Checkmark",p.displayName="Checkmark";var h=(0,a.I4)("div",(function(e){var t=e.$theme.typography;return c(c(c({verticalAlign:"middle"},function(e){var t,r=e.$labelPlacement,o=void 0===r?"":r,i=e.$theme,n=i.sizing.scale300;switch(o){case"top":t="Bottom";break;case"bottom":t="Top";break;case"left":t="Right";break;default:t="Left"}return"rtl"===i.direction&&"Left"===t?t="Right":"rtl"===i.direction&&"Right"===t&&(t="Left"),s({},"padding".concat(t),n)}(e)),{},{color:u(e)},t.LabelMedium),{},{lineHeight:"24px"})}));h.displayName="Label",h.displayName="Label";var m=(0,a.I4)("input",{opacity:0,width:0,height:0,overflow:"hidden",margin:0,padding:0,position:"absolute"});m.displayName="Input",m.displayName="Input";var b=(0,a.I4)("div",(function(e){var t=e.$theme.colors.toggleFill;return e.$disabled?t=e.$theme.colors.toggleFillDisabled:e.$checked&&e.$error?t=e.$theme.colors.tickFillErrorSelected:e.$checked&&(t=e.$theme.colors.toggleFillChecked),{backgroundColor:t,borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(e.$theme.colors.accent):e.$isHovered&&!e.$disabled?e.$theme.lighting.shadow500:e.$theme.lighting.shadow400,outline:"none",height:e.$theme.sizing.scale700,width:e.$theme.sizing.scale700,transform:e.$checked?"translateX(".concat("rtl"===e.$theme.direction?"-100%":"100%",")"):null,transition:"transform ".concat(e.$theme.animation.timing200)}}));b.displayName="Toggle",b.displayName="Toggle";var f=(0,a.I4)("div",(function(e){var t=e.$theme.colors.toggleTrackFill;return e.$disabled?t=e.$theme.colors.toggleTrackFillDisabled:e.$error&&e.$checked&&(t=e.$theme.colors.tickFillError),{alignItems:"center",backgroundColor:t,borderTopLeftRadius:"7px",borderTopRightRadius:"7px",borderBottomRightRadius:"7px",borderBottomLeftRadius:"7px",display:"flex",height:e.$theme.sizing.scale550,marginTop:e.$theme.sizing.scale200,marginBottom:e.$theme.sizing.scale100,marginLeft:e.$theme.sizing.scale200,marginRight:e.$theme.sizing.scale100,width:e.$theme.sizing.scale1000}}));f.displayName="ToggleTrack",f.displayName="ToggleTrack";var v=Object.freeze({default:"default",toggle:"toggle",toggle_round:"toggle"}),y=Object.freeze({top:"top",right:"right",bottom:"bottom",left:"left"}),k=r(56498);function $(e){return $="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},$(e)}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},w.apply(this,arguments)}function F(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function S(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,o=R(e);if(t){var i=R(this).constructor;r=Reflect.construct(o,arguments,i)}else r=o.apply(this,arguments);return function(e,t){if(t&&("object"===$(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return C(e)}(this,r)}}function C(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}function L(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var T=function(e){return e.stopPropagation()},M=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&&x(e,t)}(l,e);var t,r,i,a=S(l);function l(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return L(C(e=a.call.apply(a,[this].concat(r))),"state",{isFocused:e.props.autoFocus||!1,isFocusVisible:!1,isHovered:!1,isActive:!1}),L(C(e),"onMouseEnter",(function(t){e.setState({isHovered:!0}),e.props.onMouseEnter(t)})),L(C(e),"onMouseLeave",(function(t){e.setState({isHovered:!1,isActive:!1}),e.props.onMouseLeave(t)})),L(C(e),"onMouseDown",(function(t){e.setState({isActive:!0}),e.props.onMouseDown(t)})),L(C(e),"onMouseUp",(function(t){e.setState({isActive:!1}),e.props.onMouseUp(t)})),L(C(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t),(0,k.pP)(t)&&e.setState({isFocusVisible:!0})})),L(C(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t),!1!==e.state.isFocusVisible&&e.setState({isFocusVisible:!1})})),e}return t=l,(r=[{key:"componentDidMount",value:function(){var e=this.props,t=e.autoFocus,r=e.inputRef;t&&r.current&&r.current.focus()}},{key:"render",value:function(){var e=this.props,t=e.overrides,r=void 0===t?{}:t,i=e.onChange,a=e.labelPlacement,l=void 0===a?this.props.checkmarkType===v.toggle?"left":"right":a,c=e.inputRef,s=e.isIndeterminate,d=e.error,u=e.disabled,y=e.value,k=e.name,$=e.type,F=e.checked,x=e.children,S=e.required,C=e.title,R=r.Root,L=r.Checkmark,M=r.Label,O=r.Input,P=r.Toggle,j=r.ToggleTrack,I=(0,n.De)(R)||g,B=(0,n.De)(L)||p,E=(0,n.De)(M)||h,D=(0,n.De)(O)||m,W=(0,n.De)(P)||b,H=(0,n.De)(j)||f,z={onChange:i,onFocus:this.onFocus,onBlur:this.onBlur},V={onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},_={$isFocused:this.state.isFocused,$isFocusVisible:this.state.isFocusVisible,$isHovered:this.state.isHovered,$isActive:this.state.isActive,$error:d,$checked:F,$isIndeterminate:s,$required:S,$disabled:u,$value:y},A=x&&o.createElement(E,w({$labelPlacement:l},_,(0,n.PC)(M)),this.props.containsInteractiveElement?o.createElement("div",{onClick:function(e){return e.preventDefault()}},x):x);return o.createElement(I,w({"data-baseweb":"checkbox",title:C||null,$labelPlacement:l},_,V,(0,n.PC)(R)),("top"===l||"left"===l)&&A,this.props.checkmarkType===v.toggle?o.createElement(H,w({},_,(0,n.PC)(j)),o.createElement(W,w({},_,(0,n.PC)(P)))):o.createElement(B,w({},_,(0,n.PC)(L))),o.createElement(D,w({value:y,name:k,checked:F,required:S,"aria-label":this.props["aria-label"]||this.props.ariaLabel,"aria-checked":s?"mixed":F,"aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":d||null,"aria-required":S||null,disabled:u,type:$,ref:c,onClick:T},_,z,(0,n.PC)(O))),("bottom"===l||"right"===l)&&A)}}])&&F(t.prototype,r),i&&F(t,i),Object.defineProperty(t,"prototype",{writable:!1}),l}(o.Component);L(M,"defaultProps",{overrides:{},checked:!1,containsInteractiveElement:!1,disabled:!1,autoFocus:!1,isIndeterminate:!1,inputRef:o.createRef(),error:!1,type:"checkbox",checkmarkType:v.default,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});const O=M;var P=r(32735),j=r(25571),I=r(29669),B=r(3101),E=r(58144),D=r(93480),W=r(997),H=r(78286),z=r(34914),V=r(90114),_=r(90782);function A(e){var t;let{width:r,element:n,disabled:a,widgetMgr:l,fragmentId:c}=e;const[s,d]=(0,B.t)({getStateFromWidgetMgr:N,getDefaultStateFromProto:U,getCurrStateFromProto:X,updateWidgetMgrState:q,element:n,widgetMgr:l,fragmentId:c}),u=(0,o.useCallback)((e=>{d({value:e.target.checked,fromUi:!0})}),[d]),g=(0,i.u)(),{colors:p,spacing:h,sizes:m}=g,b=(0,E.iq)(g),f=a?p.fadedText40:p.bodyText;return(0,_.jsx)(V.p,{className:"row-widget stCheckbox","data-testid":"stCheckbox",width:r,children:(0,_.jsx)(O,{checked:s,disabled:a,onChange:u,"aria-label":n.label,checkmarkType:n.type===I.Sc.StyleType.TOGGLE?v.toggle:v.default,labelPlacement:y.right,overrides:{Root:{style:e=>{let{$isFocusVisible:t}=e;return{marginBottom:h.none,marginTop:h.none,paddingRight:h.twoThirdsSmFont,backgroundColor:t?p.darkenedBgMix25:"",display:"flex",alignItems:"start"}}},Toggle:{style:e=>{let{$checked:t}=e,r=b?p.bgColor:p.bodyText;return a&&(r=b?p.gray70:p.gray90),{width:`calc(${m.checkbox} - ${g.spacing.twoXS})`,height:`calc(${m.checkbox} - ${g.spacing.twoXS})`,transform:t?`translateX(${m.checkbox})`:"",backgroundColor:r,boxShadow:""}}},ToggleTrack:{style:e=>{let{$checked:t,$isHovered:r}=e,o=p.fadedText40;return r&&!a&&(o=p.fadedText20),t&&!a&&(o=p.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:g.spacing.twoXS,paddingLeft:g.spacing.threeXS,paddingRight:g.spacing.threeXS,width:`calc(2 * ${m.checkbox})`,minWidth:`calc(2 * ${m.checkbox})`,height:m.checkbox,minHeight:m.checkbox,borderBottomLeftRadius:g.radii.lg,borderTopLeftRadius:g.radii.lg,borderBottomRightRadius:g.radii.lg,borderTopRightRadius:g.radii.lg,backgroundColor:o}}},Checkmark:{style:e=>{let{$isFocusVisible:t,$checked:r}=e;const o=r&&!a?p.primary:p.fadedText40;return{outline:0,width:m.checkbox,height:m.checkbox,marginTop:g.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:t&&r?`0 0 0 0.2rem ${(0,P.No)(p.primary,.5)}`:"",borderLeftWidth:m.borderWidth,borderRightWidth:m.borderWidth,borderTopWidth:m.borderWidth,borderBottomWidth:m.borderWidth,borderLeftColor:o,borderRightColor:o,borderTopColor:o,borderBottomColor:o}}},Label:{style:{position:"relative",color:f}}},children:(0,_.jsxs)(V.x,{visibility:(0,j.yv)(null===(t=n.labelVisibility)||void 0===t?void 0:t.value),"data-testid":"stWidgetLabel",children:[(0,_.jsx)(z.Ay,{source:n.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),n.help&&(0,_.jsx)(H.Cl,{color:f,children:(0,_.jsx)(D.A,{content:n.help,placement:W.W.TOP_RIGHT})})]})})})}function N(e,t){return e.getBoolValue(t)}function U(e){var t;return null!==(t=e.default)&&void 0!==t?t:null}function X(e){var t;return null!==(t=e.value)&&void 0!==t?t:null}function q(e,t,r,o){t.setBoolValue(e,r.value,{fromUi:r.fromUi},o)}const G=(0,o.memo)(A)},34752:(e,t,r)=>{r.d(t,{X:()=>a,o:()=>n});var o=r(58878),i=r(25571);class n{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:n}=e;(0,o.useEffect)((()=>{if(!(0,i._L)(t.formId))return;const e=r.addFormClearedListener(t.formId,n);return()=>{e.disconnect()}}),[t,r,n])}},3101:(e,t,r)=>{r.d(t,{_:()=>a,t:()=>l});var o=r(58878),i=r(34752),n=r(25571);function a(e){let{getStateFromWidgetMgr:t,getDefaultState:r,updateWidgetMgrState:a,element:l,widgetMgr:c,fragmentId:s}=e;const[d,u]=(0,o.useState)((()=>{var e;return null!==(e=t(c,l))&&void 0!==e?e:r(c,l)})),[g,p]=(0,o.useState)({value:d,fromUi:!1});(0,o.useEffect)((()=>{(0,n.hX)(g)||(p(null),u(g.value),a(l,c,g,s))}),[g,a,l,c,s]);const h=(0,o.useCallback)((()=>{p({value:r(c,l),fromUi:!0})}),[p,l,r,c]);return(0,i.X)({widgetMgr:c,element:l,onFormCleared:h}),[d,p]}function l(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:r,getCurrStateFromProto:i,updateWidgetMgrState:n,element:l,widgetMgr:c,fragmentId:s}=e;const d=(0,o.useCallback)(((e,t)=>r(t)),[r]),[u,g]=a({getStateFromWidgetMgr:t,getDefaultState:d,updateWidgetMgrState:n,element:l,widgetMgr:c,fragmentId:s});return(0,o.useEffect)((()=>{l.setValue&&(l.setValue=!1,g({value:i(l),fromUi:!1}))}),[l,i,g]),[u,g]}}}]);
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[245],{245:(e,t,r)=>{r.r(t),r.d(t,{default:()=>G});var o=r(58878),i=r(8151),n=r(35331),a=r(57224);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return 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}function d(e){var t=e.$disabled,r=e.$checked,o=e.$isIndeterminate,i=e.$error,n=e.$isHovered,a=e.$isActive,l=e.$theme.colors;return t?r||o?l.tickFillDisabled:l.tickFill:i&&(o||r)?a?l.tickFillErrorSelectedHoverActive:n?l.tickFillErrorSelectedHover:l.tickFillErrorSelected:i?a?l.tickFillErrorHoverActive:n?l.tickFillErrorHover:l.tickFillError:o||r?a?l.tickFillSelectedHoverActive:n?l.tickFillSelectedHover:l.tickFillSelected:a?l.tickFillActive:n?l.tickFillHover:l.tickFill}function u(e){var t=e.$disabled,r=e.$theme.colors;return t?r.contentSecondary:r.contentPrimary}var g=(0,a.I4)("label",(function(e){var t=e.$disabled,r=e.$labelPlacement;return{flexDirection:"top"===r||"bottom"===r?"column":"row",display:"flex",alignItems:"top"===r||"bottom"===r?"center":"flex-start",cursor:t?"not-allowed":"pointer",userSelect:"none"}}));g.displayName="Root",g.displayName="Root";var p=(0,a.I4)("span",(function(e){var t=e.$checked,r=e.$disabled,o=e.$error,i=e.$isIndeterminate,n=e.$theme,a=e.$isFocusVisible,l=n.sizing,c=n.animation,s=r?n.colors.tickMarkFillDisabled:o?n.colors.tickMarkFillError:n.colors.tickMarkFill,u=encodeURIComponent('\n <svg width="14" height="4" viewBox="0 0 14 4" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M14 0.5H0V3.5H14V0.5Z" fill="'.concat(s,'"/>\n </svg>\n ')),g=encodeURIComponent('\n <svg width="17" height="13" viewBox="0 0 17 13" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M6.50002 12.6L0.400024 6.60002L2.60002 4.40002L6.50002 8.40002L13.9 0.900024L16.1 3.10002L6.50002 12.6Z" fill="'.concat(s,'"/>\n </svg>\n ')),p=n.borders.checkboxBorderRadius,h=function(e){var t=e.$disabled,r=e.$checked,o=e.$error,i=e.$isIndeterminate,n=e.$theme,a=e.$isFocusVisible,l=n.colors;return t?l.tickFillDisabled:r||i?"transparent":o?l.borderNegative:a?l.borderSelected:l.tickBorder}(e);return{flex:"0 0 auto",transitionDuration:c.timing200,transitionTimingFunction:c.easeOutCurve,transitionProperty:"background-image, border-color, background-color",width:l.scale700,height:l.scale700,left:"4px",top:"4px",boxSizing:"border-box",borderLeftStyle:"solid",borderRightStyle:"solid",borderTopStyle:"solid",borderBottomStyle:"solid",borderLeftWidth:"3px",borderRightWidth:"3px",borderTopWidth:"3px",borderBottomWidth:"3px",borderLeftColor:h,borderRightColor:h,borderTopColor:h,borderBottomColor:h,borderTopLeftRadius:p,borderTopRightRadius:p,borderBottomRightRadius:p,borderBottomLeftRadius:p,outline:a&&t?"3px solid ".concat(n.colors.accent):"none",display:"inline-block",verticalAlign:"middle",backgroundImage:i?"url('data:image/svg+xml,".concat(u,"');"):t?"url('data:image/svg+xml,".concat(g,"');"):null,backgroundColor:d(e),backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"contain",marginTop:n.sizing.scale0,marginBottom:n.sizing.scale0,marginLeft:n.sizing.scale0,marginRight:n.sizing.scale0}}));p.displayName="Checkmark",p.displayName="Checkmark";var h=(0,a.I4)("div",(function(e){var t=e.$theme.typography;return c(c(c({verticalAlign:"middle"},function(e){var t,r=e.$labelPlacement,o=void 0===r?"":r,i=e.$theme,n=i.sizing.scale300;switch(o){case"top":t="Bottom";break;case"bottom":t="Top";break;case"left":t="Right";break;default:t="Left"}return"rtl"===i.direction&&"Left"===t?t="Right":"rtl"===i.direction&&"Right"===t&&(t="Left"),s({},"padding".concat(t),n)}(e)),{},{color:u(e)},t.LabelMedium),{},{lineHeight:"24px"})}));h.displayName="Label",h.displayName="Label";var m=(0,a.I4)("input",{opacity:0,width:0,height:0,overflow:"hidden",margin:0,padding:0,position:"absolute"});m.displayName="Input",m.displayName="Input";var b=(0,a.I4)("div",(function(e){var t=e.$theme.colors.toggleFill;return e.$disabled?t=e.$theme.colors.toggleFillDisabled:e.$checked&&e.$error?t=e.$theme.colors.tickFillErrorSelected:e.$checked&&(t=e.$theme.colors.toggleFillChecked),{backgroundColor:t,borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(e.$theme.colors.accent):e.$isHovered&&!e.$disabled?e.$theme.lighting.shadow500:e.$theme.lighting.shadow400,outline:"none",height:e.$theme.sizing.scale700,width:e.$theme.sizing.scale700,transform:e.$checked?"translateX(".concat("rtl"===e.$theme.direction?"-100%":"100%",")"):null,transition:"transform ".concat(e.$theme.animation.timing200)}}));b.displayName="Toggle",b.displayName="Toggle";var f=(0,a.I4)("div",(function(e){var t=e.$theme.colors.toggleTrackFill;return e.$disabled?t=e.$theme.colors.toggleTrackFillDisabled:e.$error&&e.$checked&&(t=e.$theme.colors.tickFillError),{alignItems:"center",backgroundColor:t,borderTopLeftRadius:"7px",borderTopRightRadius:"7px",borderBottomRightRadius:"7px",borderBottomLeftRadius:"7px",display:"flex",height:e.$theme.sizing.scale550,marginTop:e.$theme.sizing.scale200,marginBottom:e.$theme.sizing.scale100,marginLeft:e.$theme.sizing.scale200,marginRight:e.$theme.sizing.scale100,width:e.$theme.sizing.scale1000}}));f.displayName="ToggleTrack",f.displayName="ToggleTrack";var v=Object.freeze({default:"default",toggle:"toggle",toggle_round:"toggle"}),y=Object.freeze({top:"top",right:"right",bottom:"bottom",left:"left"}),k=r(56498);function $(e){return $="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},$(e)}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},w.apply(this,arguments)}function F(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function C(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,o=R(e);if(t){var i=R(this).constructor;r=Reflect.construct(o,arguments,i)}else r=o.apply(this,arguments);return function(e,t){if(t&&("object"===$(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return S(e)}(this,r)}}function S(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}function L(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var T=function(e){return e.stopPropagation()},M=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&&x(e,t)}(l,e);var t,r,i,a=C(l);function l(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return L(S(e=a.call.apply(a,[this].concat(r))),"state",{isFocused:e.props.autoFocus||!1,isFocusVisible:!1,isHovered:!1,isActive:!1}),L(S(e),"onMouseEnter",(function(t){e.setState({isHovered:!0}),e.props.onMouseEnter(t)})),L(S(e),"onMouseLeave",(function(t){e.setState({isHovered:!1,isActive:!1}),e.props.onMouseLeave(t)})),L(S(e),"onMouseDown",(function(t){e.setState({isActive:!0}),e.props.onMouseDown(t)})),L(S(e),"onMouseUp",(function(t){e.setState({isActive:!1}),e.props.onMouseUp(t)})),L(S(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t),(0,k.pP)(t)&&e.setState({isFocusVisible:!0})})),L(S(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t),!1!==e.state.isFocusVisible&&e.setState({isFocusVisible:!1})})),e}return t=l,(r=[{key:"componentDidMount",value:function(){var e=this.props,t=e.autoFocus,r=e.inputRef;t&&r.current&&r.current.focus()}},{key:"render",value:function(){var e=this.props,t=e.overrides,r=void 0===t?{}:t,i=e.onChange,a=e.labelPlacement,l=void 0===a?this.props.checkmarkType===v.toggle?"left":"right":a,c=e.inputRef,s=e.isIndeterminate,d=e.error,u=e.disabled,y=e.value,k=e.name,$=e.type,F=e.checked,x=e.children,C=e.required,S=e.title,R=r.Root,L=r.Checkmark,M=r.Label,O=r.Input,P=r.Toggle,j=r.ToggleTrack,I=(0,n.De)(R)||g,B=(0,n.De)(L)||p,E=(0,n.De)(M)||h,D=(0,n.De)(O)||m,W=(0,n.De)(P)||b,H=(0,n.De)(j)||f,z={onChange:i,onFocus:this.onFocus,onBlur:this.onBlur},V={onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},_={$isFocused:this.state.isFocused,$isFocusVisible:this.state.isFocusVisible,$isHovered:this.state.isHovered,$isActive:this.state.isActive,$error:d,$checked:F,$isIndeterminate:s,$required:C,$disabled:u,$value:y},A=x&&o.createElement(E,w({$labelPlacement:l},_,(0,n.PC)(M)),this.props.containsInteractiveElement?o.createElement("div",{onClick:function(e){return e.preventDefault()}},x):x);return o.createElement(I,w({"data-baseweb":"checkbox",title:S||null,$labelPlacement:l},_,V,(0,n.PC)(R)),("top"===l||"left"===l)&&A,this.props.checkmarkType===v.toggle?o.createElement(H,w({},_,(0,n.PC)(j)),o.createElement(W,w({},_,(0,n.PC)(P)))):o.createElement(B,w({},_,(0,n.PC)(L))),o.createElement(D,w({value:y,name:k,checked:F,required:C,"aria-label":this.props["aria-label"]||this.props.ariaLabel,"aria-checked":s?"mixed":F,"aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":d||null,"aria-required":C||null,disabled:u,type:$,ref:c,onClick:T},_,z,(0,n.PC)(O))),("bottom"===l||"right"===l)&&A)}}])&&F(t.prototype,r),i&&F(t,i),Object.defineProperty(t,"prototype",{writable:!1}),l}(o.Component);L(M,"defaultProps",{overrides:{},checked:!1,containsInteractiveElement:!1,disabled:!1,autoFocus:!1,isIndeterminate:!1,inputRef:o.createRef(),error:!1,type:"checkbox",checkmarkType:v.default,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});const O=M;var P=r(32735),j=r(25571),I=r(29669),B=r(3101),E=r(58144),D=r(93480),W=r(997),H=r(78286),z=r(34914),V=r(90114),_=r(90782);function A(e){var t;let{width:r,element:n,disabled:a,widgetMgr:l,fragmentId:c}=e;const[s,d]=(0,B.t)({getStateFromWidgetMgr:N,getDefaultStateFromProto:U,getCurrStateFromProto:X,updateWidgetMgrState:q,element:n,widgetMgr:l,fragmentId:c}),u=(0,o.useCallback)((e=>{d({value:e.target.checked,fromUi:!0})}),[d]),g=(0,i.u)(),{colors:p,spacing:h,sizes:m}=g,b=(0,E.iq)(g),f=a?p.fadedText40:p.bodyText;return(0,_.jsx)(V.p,{className:"row-widget stCheckbox","data-testid":"stCheckbox",width:r,children:(0,_.jsx)(O,{checked:s,disabled:a,onChange:u,"aria-label":n.label,checkmarkType:n.type===I.Sc.StyleType.TOGGLE?v.toggle:v.default,labelPlacement:y.right,overrides:{Root:{style:e=>{let{$isFocusVisible:t}=e;return{marginBottom:h.none,marginTop:h.none,paddingRight:h.twoThirdsSmFont,backgroundColor:t?p.darkenedBgMix25:"",display:"flex",alignItems:"start"}}},Toggle:{style:e=>{let{$checked:t}=e,r=b?p.bgColor:p.bodyText;return a&&(r=b?p.gray70:p.gray90),{width:`calc(${m.checkbox} - ${g.spacing.twoXS})`,height:`calc(${m.checkbox} - ${g.spacing.twoXS})`,transform:t?`translateX(${m.checkbox})`:"",backgroundColor:r,boxShadow:""}}},ToggleTrack:{style:e=>{let{$checked:t,$isHovered:r}=e,o=p.fadedText40;return r&&!a&&(o=p.fadedText20),t&&!a&&(o=p.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:g.spacing.twoXS,paddingLeft:g.spacing.threeXS,paddingRight:g.spacing.threeXS,width:`calc(2 * ${m.checkbox})`,minWidth:`calc(2 * ${m.checkbox})`,height:m.checkbox,minHeight:m.checkbox,borderBottomLeftRadius:g.radii.lg,borderTopLeftRadius:g.radii.lg,borderBottomRightRadius:g.radii.lg,borderTopRightRadius:g.radii.lg,backgroundColor:o}}},Checkmark:{style:e=>{let{$isFocusVisible:t,$checked:r}=e;const o=r&&!a?p.primary:p.fadedText40;return{outline:0,width:m.checkbox,height:m.checkbox,marginTop:g.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:t&&r?`0 0 0 0.2rem ${(0,P.No)(p.primary,.5)}`:"",borderLeftWidth:m.borderWidth,borderRightWidth:m.borderWidth,borderTopWidth:m.borderWidth,borderBottomWidth:m.borderWidth,borderLeftColor:o,borderRightColor:o,borderTopColor:o,borderBottomColor:o}}},Label:{style:{position:"relative",color:f}}},children:(0,_.jsxs)(V.x,{visibility:(0,j.yv)(null===(t=n.labelVisibility)||void 0===t?void 0:t.value),"data-testid":"stWidgetLabel",children:[(0,_.jsx)(z.Ay,{source:n.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),n.help&&(0,_.jsx)(H.Cl,{color:f,children:(0,_.jsx)(D.A,{content:n.help,placement:W.W.TOP_RIGHT})})]})})})}function N(e,t){return e.getBoolValue(t)}function U(e){var t;return null!==(t=e.default)&&void 0!==t?t:null}function X(e){var t;return null!==(t=e.value)&&void 0!==t?t:null}function q(e,t,r,o){t.setBoolValue(e,r.value,{fromUi:r.fromUi},o)}const G=(0,o.memo)(A)},34752:(e,t,r)=>{r.d(t,{X:()=>a,o:()=>n});var o=r(58878),i=r(25571);class n{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:n}=e;(0,o.useEffect)((()=>{if(!(0,i._L)(t.formId))return;const e=r.addFormClearedListener(t.formId,n);return()=>{e.disconnect()}}),[t,r,n])}},3101:(e,t,r)=>{r.d(t,{_:()=>a,t:()=>l});var o=r(58878),i=r(34752),n=r(25571);function a(e){let{getStateFromWidgetMgr:t,getDefaultState:r,updateWidgetMgrState:a,element:l,widgetMgr:c,fragmentId:s,onFormCleared:d}=e;const[u,g]=(0,o.useState)((()=>{var e;return null!==(e=t(c,l))&&void 0!==e?e:r(c,l)})),[p,h]=(0,o.useState)({value:u,fromUi:!1});(0,o.useEffect)((()=>{(0,n.hX)(p)||(h(null),g(p.value),a(l,c,p,s))}),[p,a,l,c,s]);const m=(0,o.useCallback)((()=>{h({value:r(c,l),fromUi:!0}),null===d||void 0===d||d()}),[h,l,r,c,d]);return(0,i.X)({widgetMgr:c,element:l,onFormCleared:m}),[u,h]}function l(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:r,getCurrStateFromProto:i,updateWidgetMgrState:n,element:l,widgetMgr:c,fragmentId:s,onFormCleared:d}=e;const u=(0,o.useCallback)(((e,t)=>r(t)),[r]),[g,p]=a({getStateFromWidgetMgr:t,getDefaultState:u,updateWidgetMgrState:n,element:l,widgetMgr:c,fragmentId:s,onFormCleared:d});return(0,o.useEffect)((()=>{l.setValue&&(l.setValue=!1,p({value:i(l),fromUi:!1}))}),[l,i,p]),[g,p]}}}]);
|
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[3710],{40223:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>xe});var i=o(58878),r=o(6334),n=o(72192),l=o(59353),a=o(78025),s=o(43338),c=o(8151),d=o(68994),h=o(58144),u=o(85850),g=o(22044),m=o(29669);var p=o(53124),b=o.n(p),f=o(32782),y=o(67253),v=o(1780),w=o(84152),S=o(6240),x=o(90782);const j=e=>{let{error:t,width:o,deltaType:i}=e;return t instanceof C?(0,x.jsx)(S.A,{width:o,name:"No Mapbox token provided",message:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("p",{children:["To use ",(0,x.jsxs)("code",{children:["st.",i]})," or ",(0,x.jsx)("code",{children:"st.map"})," you need to set up a Mapbox access token."]}),(0,x.jsxs)("p",{children:["To get a token, create an account at"," ",(0,x.jsx)("a",{href:"https://mapbox.com",children:"https://mapbox.com"}),". It's free for moderate usage levels!"]}),(0,x.jsxs)("p",{children:["Once you have a token, just set it using the Streamlit config option ",(0,x.jsx)("code",{children:"mapbox.token"})," and don't forget to restart your Streamlit server at this point if it's still running, then reload this tab."]}),(0,x.jsxs)("p",{children:["See"," ",(0,x.jsx)("a",{href:"https://docs.streamlit.io/develop/api-reference/configuration/config.toml",children:"our documentation"})," ","for more info on how to set config options."]})]})}):t instanceof k?(0,x.jsx)(S.A,{width:o,name:"Error fetching Streamlit Mapbox token",message:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("p",{children:"This app requires an internet connection."}),(0,x.jsx)("p",{children:"Please check your connection and try again."}),(0,x.jsxs)("p",{children:["If you think this is a bug, please file bug report"," ",(0,x.jsx)("a",{href:"https://github.com/streamlit/streamlit/issues/new/choose",children:"here"}),"."]})]})}):(0,x.jsx)(S.A,{width:o,name:"Error fetching Streamlit Mapbox token",message:t.message})};class C extends Error{}class k extends Error{}const A="https://data.streamlit.io/tokens.json",F="mapbox",M=e=>t=>{class o extends i.PureComponent{constructor(o){super(o),this.context=void 0,this.initMapboxToken=async()=>{try{const e=await f.A.get(A),{[F]:t}=e.data;if(!t)throw new Error(`Missing token ${F}`);this.setState({mapboxToken:t,isFetching:!1})}catch(e){const t=(0,y.$)(e);throw this.setState({mapboxTokenError:t,isFetching:!1}),new k(`${t.message} (${A})`)}},this.render=()=>{const{mapboxToken:o,mapboxTokenError:i,isFetching:r}=this.state,{width:n}=this.props;return i?(0,x.jsx)(j,{width:n,error:i,deltaType:e}):r?(0,x.jsx)(v.E,{element:m.EA.create({style:m.EA.SkeletonStyle.ELEMENT})}):(0,x.jsx)(t,{...this.props,mapboxToken:o,width:n})},this.state={isFetching:!0,mapboxToken:void 0,mapboxTokenError:void 0}}componentDidMount(){const e=this.props.element.mapboxToken||this.context.libConfig.mapboxToken;e?this.setState({mapboxToken:e,isFetching:!1}):this.initMapboxToken()}}return o.displayName=`withMapboxToken(${t.displayName||t.name})`,o.contextType=w.n,b()(o,t)};var T=o(89653);const N=(0,T.A)("div",{target:"e1az0zs51"})((e=>{let{width:t,height:o}=e;return{position:"relative",height:o,width:t}}),""),E=(0,T.A)("div",{target:"e1az0zs50"})((e=>{let{theme:t}=e;return{position:"absolute",right:"2.625rem",top:t.spacing.md,zIndex:1,".mapboxgl-ctrl.mapboxgl-ctrl-group":{overflow:"hidden",background:t.colors.bgColor},"button:not(:disabled)":{background:t.colors.bgColor,"& + button":{borderTopColor:t.colors.secondaryBg},"&.mapboxgl-ctrl-icon:hover":{backgroundColor:(0,h.iq)(t)?"":t.colors.darkenedBgMix25},"& span":{filter:(0,h.iq)(t)?"":"invert(100%)"}}}}),"");var I=o(21640),O=o(71034),V=o.n(O),$=o(32735);var W=o(3101),D=o(14251),U=o(86202),P=o(26592),_=o(64639),z=o(73417),J=o(27126),B=o(38287);const L={classes:{...z,...o(19720),...B,...o(14249),CartoLayer:D.A},functions:{colorBins:U.A,colorCategories:P.A,colorContinuous:_.A}},q=new J.A({configuration:L});var G=o(44605),X=o(24983),Z=o(68212),K=o(20302),R=o(52265),H=o(60152),Q=o(70023),Y=o(6934),ee=o(34676),te=o(36217),oe=o(79579),ie=o(5830),re=o(74839),ne=o(16554),le=o(10762),ae=o(71749),se=o(45310),ce=o(26642),de=o(38610),he=o(41881);const ue={[ie.A.layerName]:["getFillColor"],[re.A.layerName]:["getFillColor"],[ne.Ay.layerName]:["getFillColor"],[le.A.layerName]:["getFillColor"],[ae.A.layerName]:["getFillColor"],[se.A.layerName]:["getFillColor"],[ce.A.layerName]:["getColor"],[G.A.layerName]:["getTargetColor","getSourceColor"],[X.A.layerName]:["getFillColor"],[Z.A.layerName]:["getFillColor"],[K.A.layerName]:["getColor"],[R.A.layerName]:["getColor"],[H.A.layerName]:["getColor"],[Q.A.layerName]:["getColor"],[Y.A.layerName]:["getFillColor"],[ee.A.layerName]:["getFillColor","getColor","getLineColor"],[te.A.layerName]:["getFillColor"],[oe.A.layerName]:["getColor"],[de.A.layerName]:["getColor"],[he.A.layerName]:["getColor"]},ge=e=>{let{isSelected:t,object:o,objectInfo:i,opacity:r,originalFillFunction:n}=e;const l=(e=>{let{object:t,objectInfo:o,originalFillFunction:i}=e;const r="function"===typeof i?i(t,o):i;if(Array.isArray(r))return[r[0]||0,r[1]||0,r[2]||0,r[3]||255];if("string"===typeof r&&r.startsWith("@@=")){const e=q.convert({originalColor:r}).originalColor(t);return[e[0]||0,e[1]||0,e[2]||0,e[3]||255]}return null})({object:o,objectInfo:i,originalFillFunction:n});if(!l)return null;let a=0;return a=t?Math.max("number"===typeof l[3]?l[3]:r,r):Math.min("number"===typeof l[3]?l[3]:r,r),[l[0]||0,l[1]||0,l[2]||0,a]},me={selection:{indices:{},objects:{}}},pe=(e,t)=>{const o=t.match(/{(.*?)}/g);return o&&o.forEach((o=>{const i=o.substring(1,o.length-1);e.object.hasOwnProperty(i)?t=t.replace(o,e.object[i]):e.object.hasOwnProperty("properties")&&e.object.properties.hasOwnProperty(i)&&(t=t.replace(o,e.object.properties[i]))})),t};function be(e,t){if(!t.id)return me;const o=e.getElementState(t.id,"selection");return null!==o&&void 0!==o?o:me}function fe(e,t){if(!t.id)return me;const o=e.getStringValue(t),i=o?I.A.parse(o):null;return null!==i&&void 0!==i?i:me}function ye(e,t,o,i){e.id&&t.setStringValue(e,JSON.stringify(o.value),{fromUi:o.fromUi},i)}const ve=e=>{var t;const{element:o,fragmentId:r,height:n,isFullScreen:l,isLightTheme:a,theme:s,widgetMgr:c,width:d}=e,{selectionMode:h,tooltip:u,useContainerWidth:g}=o,m=null!==l&&void 0!==l&&l,[p,b]=(0,W._)({element:o,getDefaultState:be,getStateFromWidgetMgr:fe,updateWidgetMgrState:ye,widgetMgr:c,fragmentId:r}),[f,y]=(0,i.useState)({bearing:0,pitch:0,zoom:11}),{height:v,width:w}=(e=>{let{container:t,element:o,heightFallback:r="auto",isFullScreen:n,shouldUseContainerWidth:l,widthFallback:a="auto"}=e;return{width:(0,i.useMemo)((()=>l||n?"100%":o.width||t.width||a),[t.width,o.width,n,l,a]),height:(0,i.useMemo)((()=>n&&t.height?t.height:o.height||t.height||r),[n,o.height,t.height,r])}})({element:o,isFullScreen:m,shouldUseContainerWidth:g,container:{height:n,width:d},heightFallback:(null===(t=f.initialViewState)||void 0===t?void 0:t.height)||500}),[S,x]=(0,i.useState)({}),j=h[0],C=void 0!==j,k=C&&Object.keys(p.selection.indices).length>0,A=(0,i.useMemo)((()=>Object.freeze(I.A.parse(o.json))),[m,a,o.json]),F=(0,i.useMemo)((()=>{const e={...A};if(e.mapStyle||(e.mapStyle=`mapbox://styles/mapbox/${a?"light":"dark"}-v9`),m?Object.assign(e.initialViewState,{width:w,height:v}):(e.initialViewState.height||(e.initialViewState.height=500),g&&(e.initialViewState.width=w)),e.layers){const t=Object.values(p.selection.indices).some((e=>null===e||void 0===e?void 0:e.length)),o=e.layers.some((e=>Object.hasOwn(e,"pickable")));e.layers=e.layers.map((e=>{var i,r;if(!e||Array.isArray(e)||!C)return e;o||(e.pickable=!0);const n=`${e.id||null}`,l=(null===p||void 0===p||null===(i=p.selection)||void 0===i||null===(r=i.indices)||void 0===r?void 0:r[n])||[],a=ue[e["@@type"]];if(!a)return e;const c={...e};return a.forEach((o=>{var i;c.updateTriggers={[o]:[...(null===(i=c.updateTriggers)||void 0===i?void 0:i[o])||[],l,t]};const r=!t,n=e[o];if(r||!n)return c;const a=Math.floor(102),d=(0,$.Du)(s.colors.primary),h=[d[0],d[1],d[2],255],u=(0,$.Du)(s.colors.gray20),g=[u[0],u[1],u[2],a];c[o]=(e,t)=>(e=>{let{isSelected:t,object:o,objectInfo:i,originalFillFunction:r,selectedColor:n,selectedOpacity:l=255,unselectedColor:a,unselectedOpacity:s=Math.floor(102)}=e;return t?ge({opacity:l,isSelected:!0,object:o,objectInfo:i,originalFillFunction:r})||n:ge({opacity:s,isSelected:!1,object:o,objectInfo:i,originalFillFunction:r})||a})({isSelected:l.includes(t.index),object:e,objectInfo:t,originalFillFunction:n,selectedColor:h,unselectedColor:g,selectedOpacity:255,unselectedOpacity:a})})),c}))}return null===e||void 0===e||delete e.views,q.convert(e)}),[p.selection.indices,v,m,a,C,A,g,s.colors.gray20,s.colors.primary,w]);(0,i.useEffect)((()=>{if(!V()(F.initialViewState,S)){const e=Object.keys(F.initialViewState).reduce(((e,t)=>F.initialViewState[t]===S[t]?e:{...e,[t]:F.initialViewState[t]}),{});y({...f,...e}),x(F.initialViewState)}}),[F.initialViewState,S,f]);const M=(0,i.useCallback)((e=>{if(!e||!e.object||!u)return null;const t=I.A.parse(u);return t.html?t.html=pe(e,t.html):t.text=pe(e,t.text),t}),[u]),T=(0,i.useCallback)((e=>{let{viewState:t}=e;y(t)}),[y]);return{createTooltip:M,data:p,deck:F,hasActiveSelection:k,height:v,isSelectionModeActivated:C,onViewStateChange:T,selectionMode:j,setSelection:b,viewState:f,width:w}};o(93298);(0,s.mk)([l.y,a.B]);const we=me.selection,Se=[],xe=M("st.pydeck_chart")((0,g.A)((e=>{const{collapse:t,disabled:o,disableFullscreenMode:l,element:a,expand:s,fragmentId:g,height:p,isFullScreen:b,mapboxToken:f,widgetMgr:y,width:v}=e,{mapboxToken:w}=a,S=(0,c.u)(),{createTooltip:j,data:C,deck:k,hasActiveSelection:A,height:F,isSelectionModeActivated:M,onViewStateChange:T,selectionMode:I,setSelection:O,viewState:V,width:$}=ve({element:a,fragmentId:g,height:p,isFullScreen:b,isLightTheme:(0,h.iq)(S),theme:S,widgetMgr:y,width:v}),[W,D]=(0,i.useState)(!1);(0,i.useEffect)((()=>{D(!0)}),[]);const U=(0,i.useCallback)((e=>{var t;if(void 0===I)return;const{index:o,object:i}=e,r=`${(null===(t=e.layer)||void 0===t?void 0:t.id)||null}`,n=C,l=-1===o,a=(()=>{if(l)return we;switch(I){case m.Xw.SelectionMode.SINGLE_OBJECT:var e;return(null===(e=n.selection.indices[r])||void 0===e?void 0:e[0])===o?we:{indices:{[`${r}`]:[o]},objects:{[`${r}`]:[i]}};case m.Xw.SelectionMode.MULTI_OBJECT:{const e=new Map(((null===n||void 0===n||null===(t=n.selection)||void 0===t||null===(a=t.indices)||void 0===a?void 0:a[r])||[]).map(((e,t)=>{var o,i,l;return[e,null===(o=n.selection)||void 0===o||null===(i=o.objects)||void 0===i||null===(l=i[r])||void 0===l?void 0:l[t]]})));if(e.has(o)?e.delete(o):e.set(o,i),0===e.size){const{[r]:e,...t}=n.selection.indices,{[r]:o,...i}=n.selection.objects;return{indices:t,objects:i}}return{indices:{...n.selection.indices,[`${r}`]:Array.from(e.keys())},objects:{...n.selection.objects,[`${r}`]:Array.from(e.values())}}}default:throw(e=>{throw new Error(`Reached a branch with non-exhaustive item: ${e}`)})(I),new Error("Invalid selection mode")}var t,a})();JSON.stringify(a)!==JSON.stringify(n.selection)&&O({fromUi:!0,value:{selection:a}})}),[I,C,O]),P=(0,i.useCallback)((()=>{O({value:{selection:we},fromUi:!0})}),[O]);return(0,x.jsxs)(N,{className:"stDeckGlJsonChart","data-testid":"stDeckGlJsonChart",width:$,height:F,children:[(0,x.jsx)(u.A,{isFullScreen:b,disableFullscreenMode:l,onExpand:s,onCollapse:t,target:N,locked:!(!A||o)||void 0,children:A&&!o&&(0,x.jsx)(u.K,{label:"Clear selection",onClick:P,icon:d.b})}),(0,x.jsxs)(r.A,{viewState:V,onViewStateChange:T,height:F,width:$,layers:W?k.layers:Se,getTooltip:j,ContextProvider:n.wZ.Provider,controller:!0,onClick:M&&!o?U:void 0,children:[(0,x.jsx)(n.b,{height:F,width:$,mapStyle:k.mapStyle&&("string"===typeof k.mapStyle?k.mapStyle:k.mapStyle[0]),mapboxApiAccessToken:w||f}),(0,x.jsx)(E,{children:(0,x.jsx)(n.ov,{"data-testid":"stDeckGlJsonChartZoomButton",showCompass:!1})})]})]})}),!0))},3101:(e,t,o)=>{"use strict";o.d(t,{_:()=>l,t:()=>a});var i=o(58878),r=o(34752),n=o(25571);function l(e){let{getStateFromWidgetMgr:t,getDefaultState:o,updateWidgetMgrState:l,element:a,widgetMgr:s,fragmentId:c}=e;const[d,h]=(0,i.useState)((()=>{var e;return null!==(e=t(s,a))&&void 0!==e?e:o(s,a)})),[u,g]=(0,i.useState)({value:d,fromUi:!1});(0,i.useEffect)((()=>{(0,n.hX)(u)||(g(null),h(u.value),l(a,s,u,c))}),[u,l,a,s,c]);const m=(0,i.useCallback)((()=>{g({value:o(s,a),fromUi:!0})}),[g,a,o,s]);return(0,r.X)({widgetMgr:s,element:a,onFormCleared:m}),[d,g]}function a(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:o,getCurrStateFromProto:r,updateWidgetMgrState:n,element:a,widgetMgr:s,fragmentId:c}=e;const d=(0,i.useCallback)(((e,t)=>o(t)),[o]),[h,u]=l({getStateFromWidgetMgr:t,getDefaultState:d,updateWidgetMgrState:n,element:a,widgetMgr:s,fragmentId:c});return(0,i.useEffect)((()=>{a.setValue&&(a.setValue=!1,u({value:r(a),fromUi:!1}))}),[a,r,u]),[h,u]}},63872:()=>{},35111:()=>{}}]);
|
1
|
+
(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[3710],{40223:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>xe});var i=o(58878),r=o(6334),n=o(72192),l=o(59353),a=o(78025),s=o(43338),c=o(8151),d=o(68994),h=o(58144),u=o(85850),g=o(22044),m=o(29669);var p=o(53124),b=o.n(p),f=o(32782),v=o(67253),y=o(1780),w=o(84152),S=o(6240),x=o(90782);const C=e=>{let{error:t,width:o,deltaType:i}=e;return t instanceof j?(0,x.jsx)(S.A,{width:o,name:"No Mapbox token provided",message:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("p",{children:["To use ",(0,x.jsxs)("code",{children:["st.",i]})," or ",(0,x.jsx)("code",{children:"st.map"})," you need to set up a Mapbox access token."]}),(0,x.jsxs)("p",{children:["To get a token, create an account at"," ",(0,x.jsx)("a",{href:"https://mapbox.com",children:"https://mapbox.com"}),". It's free for moderate usage levels!"]}),(0,x.jsxs)("p",{children:["Once you have a token, just set it using the Streamlit config option ",(0,x.jsx)("code",{children:"mapbox.token"})," and don't forget to restart your Streamlit server at this point if it's still running, then reload this tab."]}),(0,x.jsxs)("p",{children:["See"," ",(0,x.jsx)("a",{href:"https://docs.streamlit.io/develop/api-reference/configuration/config.toml",children:"our documentation"})," ","for more info on how to set config options."]})]})}):t instanceof k?(0,x.jsx)(S.A,{width:o,name:"Error fetching Streamlit Mapbox token",message:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("p",{children:"This app requires an internet connection."}),(0,x.jsx)("p",{children:"Please check your connection and try again."}),(0,x.jsxs)("p",{children:["If you think this is a bug, please file bug report"," ",(0,x.jsx)("a",{href:"https://github.com/streamlit/streamlit/issues/new/choose",children:"here"}),"."]})]})}):(0,x.jsx)(S.A,{width:o,name:"Error fetching Streamlit Mapbox token",message:t.message})};class j extends Error{}class k extends Error{}const F="https://data.streamlit.io/tokens.json",A="mapbox",M=e=>t=>{class o extends i.PureComponent{constructor(o){super(o),this.context=void 0,this.initMapboxToken=async()=>{try{const e=await f.A.get(F),{[A]:t}=e.data;if(!t)throw new Error(`Missing token ${A}`);this.setState({mapboxToken:t,isFetching:!1})}catch(e){const t=(0,v.$)(e);throw this.setState({mapboxTokenError:t,isFetching:!1}),new k(`${t.message} (${F})`)}},this.render=()=>{const{mapboxToken:o,mapboxTokenError:i,isFetching:r}=this.state,{width:n}=this.props;return i?(0,x.jsx)(C,{width:n,error:i,deltaType:e}):r?(0,x.jsx)(y.E,{element:m.EA.create({style:m.EA.SkeletonStyle.ELEMENT})}):(0,x.jsx)(t,{...this.props,mapboxToken:o,width:n})},this.state={isFetching:!0,mapboxToken:void 0,mapboxTokenError:void 0}}componentDidMount(){const e=this.props.element.mapboxToken||this.context.libConfig.mapboxToken;e?this.setState({mapboxToken:e,isFetching:!1}):this.initMapboxToken()}}return o.displayName=`withMapboxToken(${t.displayName||t.name})`,o.contextType=w.n,b()(o,t)};var T=o(89653);const N=(0,T.A)("div",{target:"e1az0zs51"})((e=>{let{width:t,height:o}=e;return{position:"relative",height:o,width:t}}),""),E=(0,T.A)("div",{target:"e1az0zs50"})((e=>{let{theme:t}=e;return{position:"absolute",right:"2.625rem",top:t.spacing.md,zIndex:1,".mapboxgl-ctrl.mapboxgl-ctrl-group":{overflow:"hidden",background:t.colors.bgColor},"button:not(:disabled)":{background:t.colors.bgColor,"& + button":{borderTopColor:t.colors.secondaryBg},"&.mapboxgl-ctrl-icon:hover":{backgroundColor:(0,h.iq)(t)?"":t.colors.darkenedBgMix25},"& span":{filter:(0,h.iq)(t)?"":"invert(100%)"}}}}),"");var I=o(21640),O=o(71034),V=o.n(O),$=o(32735);var W=o(3101),D=o(14251),U=o(86202),P=o(26592),_=o(64639),z=o(73417),J=o(27126),B=o(38287);const L={classes:{...z,...o(19720),...B,...o(14249),CartoLayer:D.A},functions:{colorBins:U.A,colorCategories:P.A,colorContinuous:_.A}},q=new J.A({configuration:L});var G=o(44605),X=o(24983),Z=o(68212),K=o(20302),R=o(52265),H=o(60152),Q=o(70023),Y=o(6934),ee=o(34676),te=o(36217),oe=o(79579),ie=o(5830),re=o(74839),ne=o(16554),le=o(10762),ae=o(71749),se=o(45310),ce=o(26642),de=o(38610),he=o(41881);const ue={[ie.A.layerName]:["getFillColor"],[re.A.layerName]:["getFillColor"],[ne.Ay.layerName]:["getFillColor"],[le.A.layerName]:["getFillColor"],[ae.A.layerName]:["getFillColor"],[se.A.layerName]:["getFillColor"],[ce.A.layerName]:["getColor"],[G.A.layerName]:["getTargetColor","getSourceColor"],[X.A.layerName]:["getFillColor"],[Z.A.layerName]:["getFillColor"],[K.A.layerName]:["getColor"],[R.A.layerName]:["getColor"],[H.A.layerName]:["getColor"],[Q.A.layerName]:["getColor"],[Y.A.layerName]:["getFillColor"],[ee.A.layerName]:["getFillColor","getColor","getLineColor"],[te.A.layerName]:["getFillColor"],[oe.A.layerName]:["getColor"],[de.A.layerName]:["getColor"],[he.A.layerName]:["getColor"]},ge=e=>{let{isSelected:t,object:o,objectInfo:i,opacity:r,originalFillFunction:n}=e;const l=(e=>{let{object:t,objectInfo:o,originalFillFunction:i}=e;const r="function"===typeof i?i(t,o):i;if(Array.isArray(r))return[r[0]||0,r[1]||0,r[2]||0,r[3]||255];if("string"===typeof r&&r.startsWith("@@=")){const e=q.convert({originalColor:r}).originalColor(t);return[e[0]||0,e[1]||0,e[2]||0,e[3]||255]}return null})({object:o,objectInfo:i,originalFillFunction:n});if(!l)return null;let a=0;return a=t?Math.max("number"===typeof l[3]?l[3]:r,r):Math.min("number"===typeof l[3]?l[3]:r,r),[l[0]||0,l[1]||0,l[2]||0,a]},me={selection:{indices:{},objects:{}}},pe=(e,t)=>{const o=t.match(/{(.*?)}/g);return o&&o.forEach((o=>{const i=o.substring(1,o.length-1);e.object.hasOwnProperty(i)?t=t.replace(o,e.object[i]):e.object.hasOwnProperty("properties")&&e.object.properties.hasOwnProperty(i)&&(t=t.replace(o,e.object.properties[i]))})),t};function be(e,t){if(!t.id)return me;const o=e.getElementState(t.id,"selection");return null!==o&&void 0!==o?o:me}function fe(e,t){if(!t.id)return me;const o=e.getStringValue(t),i=o?I.A.parse(o):null;return null!==i&&void 0!==i?i:me}function ve(e,t,o,i){e.id&&t.setStringValue(e,JSON.stringify(o.value),{fromUi:o.fromUi},i)}const ye=e=>{var t;const{element:o,fragmentId:r,height:n,isFullScreen:l,isLightTheme:a,theme:s,widgetMgr:c,width:d}=e,{selectionMode:h,tooltip:u,useContainerWidth:g}=o,m=null!==l&&void 0!==l&&l,[p,b]=(0,W._)({element:o,getDefaultState:be,getStateFromWidgetMgr:fe,updateWidgetMgrState:ve,widgetMgr:c,fragmentId:r}),[f,v]=(0,i.useState)({bearing:0,pitch:0,zoom:11}),{height:y,width:w}=(e=>{let{container:t,element:o,heightFallback:r="auto",isFullScreen:n,shouldUseContainerWidth:l,widthFallback:a="auto"}=e;return{width:(0,i.useMemo)((()=>l||n?"100%":o.width||t.width||a),[t.width,o.width,n,l,a]),height:(0,i.useMemo)((()=>n&&t.height?t.height:o.height||t.height||r),[n,o.height,t.height,r])}})({element:o,isFullScreen:m,shouldUseContainerWidth:g,container:{height:n,width:d},heightFallback:(null===(t=f.initialViewState)||void 0===t?void 0:t.height)||500}),[S,x]=(0,i.useState)({}),C=h[0],j=void 0!==C,k=j&&Object.keys(p.selection.indices).length>0,F=(0,i.useMemo)((()=>Object.freeze(I.A.parse(o.json))),[m,a,o.json]),A=(0,i.useMemo)((()=>{const e={...F};if(e.mapStyle||(e.mapStyle=`mapbox://styles/mapbox/${a?"light":"dark"}-v9`),m?Object.assign(e.initialViewState,{width:w,height:y}):(e.initialViewState.height||(e.initialViewState.height=500),g&&(e.initialViewState.width=w)),e.layers){const t=Object.values(p.selection.indices).some((e=>null===e||void 0===e?void 0:e.length)),o=e.layers.some((e=>Object.hasOwn(e,"pickable")));e.layers=e.layers.map((e=>{var i,r;if(!e||Array.isArray(e)||!j)return e;o||(e.pickable=!0);const n=`${e.id||null}`,l=(null===p||void 0===p||null===(i=p.selection)||void 0===i||null===(r=i.indices)||void 0===r?void 0:r[n])||[],a=ue[e["@@type"]];if(!a)return e;const c={...e};return a.forEach((o=>{var i;c.updateTriggers={[o]:[...(null===(i=c.updateTriggers)||void 0===i?void 0:i[o])||[],l,t]};const r=!t,n=e[o];if(r||!n)return c;const a=Math.floor(102),d=(0,$.Du)(s.colors.primary),h=[d[0],d[1],d[2],255],u=(0,$.Du)(s.colors.gray20),g=[u[0],u[1],u[2],a];c[o]=(e,t)=>(e=>{let{isSelected:t,object:o,objectInfo:i,originalFillFunction:r,selectedColor:n,selectedOpacity:l=255,unselectedColor:a,unselectedOpacity:s=Math.floor(102)}=e;return t?ge({opacity:l,isSelected:!0,object:o,objectInfo:i,originalFillFunction:r})||n:ge({opacity:s,isSelected:!1,object:o,objectInfo:i,originalFillFunction:r})||a})({isSelected:l.includes(t.index),object:e,objectInfo:t,originalFillFunction:n,selectedColor:h,unselectedColor:g,selectedOpacity:255,unselectedOpacity:a})})),c}))}return null===e||void 0===e||delete e.views,q.convert(e)}),[p.selection.indices,y,m,a,j,F,g,s.colors.gray20,s.colors.primary,w]);(0,i.useEffect)((()=>{if(!V()(A.initialViewState,S)){const e=Object.keys(A.initialViewState).reduce(((e,t)=>A.initialViewState[t]===S[t]?e:{...e,[t]:A.initialViewState[t]}),{});v({...f,...e}),x(A.initialViewState)}}),[A.initialViewState,S,f]);const M=(0,i.useCallback)((e=>{if(!e||!e.object||!u)return null;const t=I.A.parse(u);return t.html?t.html=pe(e,t.html):t.text=pe(e,t.text),t}),[u]),T=(0,i.useCallback)((e=>{let{viewState:t}=e;v(t)}),[v]);return{createTooltip:M,data:p,deck:A,hasActiveSelection:k,height:y,isSelectionModeActivated:j,onViewStateChange:T,selectionMode:C,setSelection:b,viewState:f,width:w}};o(93298);(0,s.mk)([l.y,a.B]);const we=me.selection,Se=[],xe=M("st.pydeck_chart")((0,g.A)((e=>{const{collapse:t,disabled:o,disableFullscreenMode:l,element:a,expand:s,fragmentId:g,height:p,isFullScreen:b,mapboxToken:f,widgetMgr:v,width:y}=e,{mapboxToken:w}=a,S=(0,c.u)(),{createTooltip:C,data:j,deck:k,hasActiveSelection:F,height:A,isSelectionModeActivated:M,onViewStateChange:T,selectionMode:I,setSelection:O,viewState:V,width:$}=ye({element:a,fragmentId:g,height:p,isFullScreen:b,isLightTheme:(0,h.iq)(S),theme:S,widgetMgr:v,width:y}),[W,D]=(0,i.useState)(!1);(0,i.useEffect)((()=>{D(!0)}),[]);const U=(0,i.useCallback)((e=>{var t;if(void 0===I)return;const{index:o,object:i}=e,r=`${(null===(t=e.layer)||void 0===t?void 0:t.id)||null}`,n=j,l=-1===o,a=(()=>{if(l)return we;switch(I){case m.Xw.SelectionMode.SINGLE_OBJECT:var e;return(null===(e=n.selection.indices[r])||void 0===e?void 0:e[0])===o?we:{indices:{[`${r}`]:[o]},objects:{[`${r}`]:[i]}};case m.Xw.SelectionMode.MULTI_OBJECT:{const e=new Map(((null===n||void 0===n||null===(t=n.selection)||void 0===t||null===(a=t.indices)||void 0===a?void 0:a[r])||[]).map(((e,t)=>{var o,i,l;return[e,null===(o=n.selection)||void 0===o||null===(i=o.objects)||void 0===i||null===(l=i[r])||void 0===l?void 0:l[t]]})));if(e.has(o)?e.delete(o):e.set(o,i),0===e.size){const{[r]:e,...t}=n.selection.indices,{[r]:o,...i}=n.selection.objects;return{indices:t,objects:i}}return{indices:{...n.selection.indices,[`${r}`]:Array.from(e.keys())},objects:{...n.selection.objects,[`${r}`]:Array.from(e.values())}}}default:throw(e=>{throw new Error(`Reached a branch with non-exhaustive item: ${e}`)})(I),new Error("Invalid selection mode")}var t,a})();JSON.stringify(a)!==JSON.stringify(n.selection)&&O({fromUi:!0,value:{selection:a}})}),[I,j,O]),P=(0,i.useCallback)((()=>{O({value:{selection:we},fromUi:!0})}),[O]);return(0,x.jsxs)(N,{className:"stDeckGlJsonChart","data-testid":"stDeckGlJsonChart",width:$,height:A,children:[(0,x.jsx)(u.A,{isFullScreen:b,disableFullscreenMode:l,onExpand:s,onCollapse:t,target:N,locked:!(!F||o)||void 0,children:F&&!o&&(0,x.jsx)(u.K,{label:"Clear selection",onClick:P,icon:d.b})}),(0,x.jsxs)(r.A,{viewState:V,onViewStateChange:T,height:A,width:$,layers:W?k.layers:Se,getTooltip:C,ContextProvider:n.wZ.Provider,controller:!0,onClick:M&&!o?U:void 0,children:[(0,x.jsx)(n.b,{height:A,width:$,mapStyle:k.mapStyle&&("string"===typeof k.mapStyle?k.mapStyle:k.mapStyle[0]),mapboxApiAccessToken:w||f}),(0,x.jsx)(E,{children:(0,x.jsx)(n.ov,{"data-testid":"stDeckGlJsonChartZoomButton",showCompass:!1})})]})]})}),!0))},3101:(e,t,o)=>{"use strict";o.d(t,{_:()=>l,t:()=>a});var i=o(58878),r=o(34752),n=o(25571);function l(e){let{getStateFromWidgetMgr:t,getDefaultState:o,updateWidgetMgrState:l,element:a,widgetMgr:s,fragmentId:c,onFormCleared:d}=e;const[h,u]=(0,i.useState)((()=>{var e;return null!==(e=t(s,a))&&void 0!==e?e:o(s,a)})),[g,m]=(0,i.useState)({value:h,fromUi:!1});(0,i.useEffect)((()=>{(0,n.hX)(g)||(m(null),u(g.value),l(a,s,g,c))}),[g,l,a,s,c]);const p=(0,i.useCallback)((()=>{m({value:o(s,a),fromUi:!0}),null===d||void 0===d||d()}),[m,a,o,s,d]);return(0,r.X)({widgetMgr:s,element:a,onFormCleared:p}),[h,m]}function a(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:o,getCurrStateFromProto:r,updateWidgetMgrState:n,element:a,widgetMgr:s,fragmentId:c,onFormCleared:d}=e;const h=(0,i.useCallback)(((e,t)=>o(t)),[o]),[u,g]=l({getStateFromWidgetMgr:t,getDefaultState:h,updateWidgetMgrState:n,element:a,widgetMgr:s,fragmentId:c,onFormCleared:d});return(0,i.useEffect)((()=>{a.setValue&&(a.setValue=!1,g({value:r(a),fromUi:!1}))}),[a,r,g]),[u,g]}},63872:()=>{},35111:()=>{}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[5281],{3727:(e,t,i)=>{i.d(t,{A:()=>c,o:()=>p});var s=i(58878),n=i(8151),l=i(70766),r=i(35331),a=i(58144),o=i(84152),d=i(90782);let p;!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(p||(p={}));const c=function(e){let{value:t,width:i,size:c=p.SMALL,overrides:g}=e;const h=(0,n.u)(),u={xs:h.spacing.twoXS,sm:h.spacing.sm,md:h.spacing.lg,lg:h.spacing.xl,xl:h.spacing.twoXL},{activeTheme:m}=s.useContext(o.n),f=!(0,a.tl)(m),x={BarContainer:{style:{marginTop:h.spacing.none,marginBottom:h.spacing.none,marginRight:h.spacing.none,marginLeft:h.spacing.none}},Bar:{style:e=>{let{$theme:t}=e;return{width:i?i.toString():void 0,marginTop:h.spacing.none,marginBottom:h.spacing.none,marginRight:h.spacing.none,marginLeft:h.spacing.none,height:u[c],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:h.spacing.twoXS,borderTopRightRadius:h.spacing.twoXS,borderBottomLeftRadius:h.spacing.twoXS,borderBottomRightRadius:h.spacing.twoXS}}},BarProgress:{style:()=>({backgroundColor:f?h.colors.primary:h.colors.blue70,borderTopLeftRadius:h.spacing.twoXS,borderTopRightRadius:h.spacing.twoXS,borderBottomLeftRadius:h.spacing.twoXS,borderBottomRightRadius:h.spacing.twoXS})}};return(0,d.jsx)(l.A,{value:t,overrides:(0,r.Qp)(x,g)})}},9830:(e,t,i)=>{i.d(t,{m:()=>s});class s{setStatus(e){return new s(this.name,this.size,this.id,e)}constructor(e,t,i,s){this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=e,this.size=t,this.id=i,this.status=s}}},55281:(e,t,i)=>{i.r(t),i.d(t,{default:()=>he});var s=i(58878),n=i(32782),l=i(71034),r=i.n(l),a=i(50609),o=i.n(a),d=i(25571),p=i(29669),c=i(34752);let g;!function(e){e.Gigabyte="gb",e.Megabyte="mb",e.Kilobyte="kb",e.Byte="b"}(g||(g={}));const h=(0,d.Q2)()?1024:1e3,u=[g.Gigabyte,g.Megabyte,g.Kilobyte,g.Byte],m=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t||(t=g.Byte),i<0&&(i=0),e<0)throw new Error("Size must be greater than or equal to 0");const s=u.indexOf(t);return s&&e>h/2?m(e/h,u[s-1],i):`${e.toFixed(i)}${t.toUpperCase()}`};var f=i(70474),x=i(78286),w=i(93480),y=i(997),b=i(97779),F=i(36459),S=i(84720),v=i(89653);const I=(0,v.A)("section",{target:"e1b2p2ww15"})((e=>{let{isDisabled:t,theme:i}=e;return{display:"flex",alignItems:"center",padding:i.spacing.lg,backgroundColor:i.colors.secondaryBg,borderRadius:i.radii.default,":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 1px ${i.colors.primary}`},color:t?i.colors.gray:i.colors.bodyText}}),""),j=(0,v.A)("div",{target:"e1b2p2ww14"})((()=>({marginRight:"auto",alignItems:"center",display:"flex"})),""),U=(0,v.A)("span",{target:"e1b2p2ww13"})((e=>{let{theme:t}=e;return{color:t.colors.darkenedBgMix100,marginRight:t.spacing.lg}}),""),A=(0,v.A)("span",{target:"e1b2p2ww12"})((e=>{let{theme:t}=e;return{marginBottom:t.spacing.twoXS}}),""),L=(0,v.A)("div",{target:"e1b2p2ww11"})({name:"1fttcpj",styles:"display:flex;flex-direction:column"}),z=(0,v.A)("div",{target:"e1b2p2ww10"})((e=>{let{theme:t}=e;return{left:0,right:0,lineHeight:t.lineHeights.tight,paddingTop:t.spacing.md,paddingLeft:t.spacing.lg,paddingRight:t.spacing.lg}}),""),M=(0,v.A)("ul",{target:"e1b2p2ww9"})((e=>{let{theme:t}=e;return{listStyleType:"none",marginBottom:t.spacing.none}}),""),C=(0,v.A)("li",{target:"e1b2p2ww8"})((e=>{let{theme:t}=e;return{margin:t.spacing.none,padding:t.spacing.none}}),""),B=(0,v.A)("div",{target:"e1b2p2ww7"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"baseline",flex:1,paddingLeft:t.spacing.lg,overflow:"hidden"}}),""),X=(0,v.A)("div",{target:"e1b2p2ww6"})((e=>{let{theme:t}=e;return{marginRight:t.spacing.sm,marginBottom:t.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),""),R=(0,v.A)("div",{target:"e1b2p2ww5"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",marginBottom:t.spacing.twoXS}}),""),k=(0,v.A)("span",{target:"e1b2p2ww4"})((e=>{let{theme:t}=e;return{marginRight:t.spacing.twoXS}}),""),D=(0,v.A)("div",{target:"e1b2p2ww3"})((e=>{let{theme:t}=e;return{display:"flex",padding:t.spacing.twoXS,color:t.colors.darkenedBgMix100}}),""),T=(0,v.A)("small",{target:"e1b2p2ww2"})((e=>{let{theme:t}=e;return{color:t.colors.danger,fontSize:t.fontSizes.sm,height:t.fontSizes.sm,lineHeight:t.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"}}),""),E=(0,v.A)("span",{target:"e1b2p2ww1"})({name:"0",styles:""}),P=e=>({[I]:{display:"flex",flexDirection:"column",alignItems:"flex-start"},[j]:{marginBottom:e.spacing.lg},[U]:{display:"none"},[z]:{paddingRight:e.spacing.lg},[R]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[X]:{width:e.sizes.full},[B]:{flexDirection:"column"},[T]:{height:"auto",whiteSpace:"initial"},[E]:{display:"none"},[C]:{margin:e.spacing.none,padding:e.spacing.none}}),V=(0,v.A)("div",{target:"e1b2p2ww0"})((e=>{let{theme:t}=e;return t.inSidebar?P(t):{[`@media (max-width: ${t.breakpoints.sm})`]:P(t)}}),"");var N=i(72718),$=i(64611),W=i(12978),H=i(90782);const O=e=>{let{multiple:t,acceptedExtensions:i,maxSizeBytes:s}=e;return(0,H.jsxs)(j,{"data-testid":"stFileUploaderDropzoneInstructions",children:[(0,H.jsx)(U,{children:(0,H.jsx)($.A,{content:N.b,size:"threeXL"})}),(0,H.jsxs)(L,{children:[(0,H.jsxs)(A,{children:["Drag and drop file",t?"s":""," here"]}),(0,H.jsxs)(W.O,{children:[`Limit ${m(s,g.Byte,0)} per file`,i.length?` \u2022 ${i.map((e=>e.replace(/^\./,"").toUpperCase())).join(", ")}`:null]})]})]})},_=e=>{let{onDrop:t,multiple:i,acceptedExtensions:s,maxSizeBytes:n,disabled:l,label:r}=e;return(0,H.jsx)(b.Ay,{onDrop:t,multiple:i,accept:s.length?s:void 0,maxSize:n,disabled:l,useFsAccessApi:!1,children:e=>{let{getRootProps:t,getInputProps:a}=e;return(0,H.jsxs)(I,{...t(),"data-testid":"stFileUploaderDropzone",isDisabled:l,"aria-label":r,children:[(0,H.jsx)("input",{"data-testid":"stFileUploaderDropzoneInput",...a()}),(0,H.jsx)(O,{multiple:i,acceptedExtensions:s,maxSizeBytes:n}),(0,H.jsx)(F.Ay,{kind:S.KX.SECONDARY,disabled:l,size:S.Pj.SMALL,children:"Browse files"})]})}})};var K=i(53124),G=i.n(K),q=i(35526),Q=i(77434),Y=i(76370);const Z=(0,v.A)("div",{target:"e1nlpozb1"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:t.spacing.twoXS,marginBottom:t.spacing.twoXS}}),""),J=(0,v.A)("div",{target:"e1nlpozb0"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"center",color:t.colors.fadedText40}}),""),ee=e=>{let{currentPage:t,totalPages:i,onNext:s,onPrevious:n}=e;return(0,H.jsxs)(Z,{"data-testid":"stFileUploaderPagination",children:[(0,H.jsx)(W.O,{children:`Showing page ${t} of ${i}`}),(0,H.jsxs)(J,{children:[(0,H.jsx)(F.Ay,{onClick:n,kind:S.KX.MINIMAL,children:(0,H.jsx)($.A,{content:Q.J,size:"xl"})}),(0,H.jsx)(F.Ay,{onClick:s,kind:S.KX.MINIMAL,children:(0,H.jsx)($.A,{content:Y.c,size:"xl"})})]})]})},te=(e,t)=>Math.ceil(e.length/t),ie=e=>G()((t=>{let{pageSize:i,items:n,resetOnAdd:l,...r}=t;const[a,o]=(0,s.useState)(0),[d,p]=(0,s.useState)(te(n,i)),c=(0,q.Z)(n);(0,s.useEffect)((()=>{c&&c.length!==n.length&&p(te(n,i)),c&&c.length<n.length?l&&o(0):a+1>=d&&o(d-1)}),[n,a,i,c,l,d]);const g=n.slice(a*i,a*i+i);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(e,{items:g,...r}),n.length>i?(0,H.jsx)(ee,{pageSize:i,totalPages:d,currentPage:a+1,onNext:()=>{o(Math.min(a+1,d-1))},onPrevious:()=>{o(Math.max(0,a-1))}}):null]})}),e);var se=i(2742),ne=i(97522),le=i(64754),re=i(3727);const ae=e=>{let{fileInfo:t}=e;return"uploading"===t.status.type?(0,H.jsx)(re.A,{value:t.status.progress,size:re.o.SMALL}):"error"===t.status.type?(0,H.jsxs)(T,{children:[(0,H.jsx)(k,{"data-testid":"stFileUploaderFileErrorMessage",children:t.status.errorMessage}),(0,H.jsx)(E,{children:(0,H.jsx)($.A,{content:se.$,size:"lg"})})]}):"uploaded"===t.status.type?(0,H.jsx)(W.O,{children:m(t.size,g.Byte)}):null},oe=e=>{let{fileInfo:t,onDelete:i}=e;return(0,H.jsxs)(R,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[(0,H.jsx)(D,{children:(0,H.jsx)($.A,{content:ne.i,size:"twoXL"})}),(0,H.jsxs)(B,{className:"stFileUploaderFileData",children:[(0,H.jsx)(X,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:t.name,children:t.name}),(0,H.jsx)(ae,{fileInfo:t})]}),(0,H.jsx)("div",{"data-testid":"stFileUploaderDeleteBtn",children:(0,H.jsx)(F.Ay,{onClick:()=>i(t.id),kind:S.KX.MINIMAL,children:(0,H.jsx)($.A,{content:le.k,size:"lg"})})})]})},de=ie((e=>{let{items:t,onDelete:i}=e;return(0,H.jsx)(M,{children:t.map((e=>(0,H.jsx)(C,{children:(0,H.jsx)(oe,{fileInfo:e,onDelete:i})},e.id)))})})),pe=e=>(0,H.jsx)(z,{children:(0,H.jsx)(de,{...e})});var ce=i(9830);class ge extends s.PureComponent{constructor(e){super(e),this.formClearHelper=new c.o,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if("ready"!==this.status)return;const e=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:s}=this.props,n=i.getFileUploaderStateValue(t);r()(e,n)||i.setFileUploaderStateValue(t,e,{fromUi:!0},s)},this.reset=()=>{this.setState({files:[]})},this.dropHandler=(e,t)=>{const{element:i}=this.props,{multipleFiles:s}=i;if(!s&&0===e.length&&t.length>1){const i=t.findIndex((e=>1===e.errors.length&&"too-many-files"===e.errors[0].code));i>=0&&(e.push(t[i].file),t.splice(i,1))}if(this.props.uploadClient.fetchFileURLs(e).then((t=>{if(!s&&e.length>0){const e=this.state.files.find((e=>"error"!==e.status.type));e&&(this.forceUpdatingStatus=!0,this.deleteFile(e.id),this.forceUpdatingStatus=!1)}o()(t,e).forEach((e=>{let[t,i]=e;this.uploadFile(t,i)}))})).catch((t=>{this.addFiles(e.map((e=>new ce.m(e.name,e.size,this.nextLocalFileId(),{type:"error",errorMessage:t}))))})),t.length>0){const e=t.map((e=>{const{file:t}=e;return new ce.m(t.name,t.size,this.nextLocalFileId(),{type:"error",errorMessage:this.getErrorMessage(e.errors[0].code,e.file)})}));this.addFiles(e)}},this.uploadFile=(e,t)=>{const i=n.A.CancelToken.source(),s=new ce.m(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:i,progress:1});this.addFile(s),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,(e=>this.onUploadProgress(e,s.id)),i.token).then((()=>this.onUploadComplete(s.id,e))).catch((e=>{n.A.isCancel(e)||this.updateFile(s.id,s.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},this.onUploadComplete=(e,t)=>{const i=this.getFile(e);(0,d.hX)(i)||"uploading"!==i.status.type||this.updateFile(i.id,i.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.getErrorMessage=(e,t)=>{switch(e){case"file-too-large":return`File must be ${m(this.maxUploadSizeInBytes,g.Byte)} or smaller.`;case"file-invalid-type":return`${t.type} files are not allowed.`;case"file-too-small":return"File size is too small.";case"too-many-files":return"Only one file is allowed.";default:return"Unexpected error. Please try again."}},this.deleteFile=e=>{const t=this.getFile(e);(0,d.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.addFiles=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((i=>({files:i.files.map((i=>i.id===e?t:i))})))},this.onUploadProgress=(e,t)=>{const i=this.getFile(t);if((0,d.hX)(i)||"uploading"!==i.status.type)return;const s=Math.round(100*e.loaded/e.total);i.status.progress!==s&&this.updateFile(t,i.setStatus({type:"uploading",cancelToken:i.status.cancelToken,progress:s}))},this.onFormCleared=()=>{this.setState({files:[]},(()=>{const e=this.createWidgetValue();if((0,d.hX)(e))return;const{widgetMgr:t,element:i,fragmentId:s}=this.props;t.setFileUploaderStateValue(i,e,{fromUi:!0},s)}))},this.state=this.initialValue}get initialValue(){const e={files:[],newestServerFileId:0},{widgetMgr:t,element:i}=this.props,s=t.getFileUploaderStateValue(i);if((0,d.hX)(s))return e;const{uploadedFileInfo:n}=s;return(0,d.hX)(n)||0===n.length?e:{files:n.map((e=>{const t=e.name,i=e.size,s=e.fileId,n=e.fileUrls;return new ce.m(t,i,this.nextLocalFileId(),{type:"uploaded",fileId:s,fileUrls:n})}))}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){return((e,t,i)=>{if(e<0)throw Error("Size must be 0 or greater");const s=u.findIndex((e=>e===t)),n=u.findIndex((e=>e===i));if(-1===s||-1===n)throw Error("Unexpected byte unit provided");if(s===n)return e;const l=Math.abs(s-n),r=h**l;return s>n?e/r:e*r})(this.props.element.maxUploadSizeMb,g.Megabyte,g.Byte)}get status(){return this.state.files.some((e=>"uploading"===e.status.type))||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const e=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:s}=this.props;void 0===i.getFileUploaderStateValue(t)&&i.setFileUploaderStateValue(t,e,{fromUi:!1},s)}createWidgetValue(){const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:i,status:s}=e,{fileId:n,fileUrls:l}=s;return new p.HY({fileId:n,fileUrls:l,name:t,size:i})}));return new p.qX({uploadedFileInfo:e})}render(){var e;const{files:t}=this.state,{element:i,disabled:s,widgetMgr:n}=this.props,l=i.type;this.formClearHelper.manageFormClearListener(n,i.formId,this.onFormCleared);const r=t.slice().reverse();return(0,H.jsxs)(V,{className:"stFileUploader","data-testid":"stFileUploader",children:[(0,H.jsx)(f.L,{label:i.label,disabled:s,labelVisibility:(0,d.yv)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,H.jsx)(x.j,{children:(0,H.jsx)(w.A,{content:i.help,placement:y.W.TOP_RIGHT})})}),(0,H.jsx)(_,{onDrop:this.dropHandler,multiple:i.multipleFiles,acceptedExtensions:l,maxSizeBytes:this.maxUploadSizeInBytes,label:i.label,disabled:s}),r.length>0&&(0,H.jsx)(pe,{items:r,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}const he=ge},34752:(e,t,i)=>{i.d(t,{X:()=>r,o:()=>l});var s=i(58878),n=i(25571);class l{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 r(e){let{element:t,widgetMgr:i,onFormCleared:l}=e;(0,s.useEffect)((()=>{if(!(0,n._L)(t.formId))return;const e=i.addFormClearedListener(t.formId,l);return()=>{e.disconnect()}}),[t,i,l])}},35526:(e,t,i)=>{i.d(t,{Z:()=>n});var s=i(58878);const n=e=>{const t=(0,s.useRef)();return(0,s.useEffect)((()=>{t.current=e}),[e]),t.current}}}]);
|
@@ -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 a=r(60667).i7`
|
2
|
+
50% {
|
3
|
+
color: rgba(0, 0, 0, 0);
|
4
|
+
}
|
5
|
+
`,l=(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 s=r(90782);const u=e=>{let{dirty:t,value:r,inForm:i,maxLength:a,className:u,type:c="single",allowEnterToSubmit:d=!0}=e;const f=[],p=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];f.push((0,s.jsx)(l,{includeDot:f.length>0,shouldBlink:t,children:e},f.length))};if(d){const e=i?"submit form":"apply";if("multiline"===c){p(`Press ${(0,n.u_)()?"\u2318":"Ctrl"}+Enter to ${e}`)}else"single"===c&&p(`Press Enter to ${e}`)}return a&&("chat"!==c||t)&&p(`${r.length}/${a}`,t&&r.length>=a),(0,s.jsx)(o.tp,{"data-testid":"InputInstructions",className:u,children:f})}},34752:(e,t,r)=>{"use strict";r.d(t,{X:()=>a,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 a(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:()=>S});var n=r(58878),o=r(94928),i=r(8151),a=r(32698),l=r.n(a),s=r(68035),u=r(70474),c=r(78286),d=r(93480),f=r(997),p=r(25571),m=r(3101),g=r(90782);const h=(e,t)=>{var r,n;return null!==(r=null!==(n=e.getStringValue(t))&&void 0!==n?n:t.default)&&void 0!==r?r:null},y=e=>{var t;return null!==(t=e.default)&&void 0!==t?t:null},b=e=>{var t;return null!==(t=e.value)&&void 0!==t?t:null},v=(e,t,r,n)=>{t.setStringValue(e,r.value,{fromUi:r.fromUi},n)},S=e=>{var t,r;let{disabled:a,element:S,widgetMgr:w,fragmentId:O,width:C}=e;const F=(0,n.useRef)(l()("text_area_")).current,[j,x]=(0,n.useState)(null!==(t=h(w,S))&&void 0!==t?t:null),[I,P]=(0,n.useState)(!1),[T,W]=(0,n.useState)(!1),E=(0,n.useCallback)((()=>{var e;x(null!==(e=S.default)&&void 0!==e?e:null),P(!0)}),[S]),[,M]=(0,m.t)({getStateFromWidgetMgr:h,getDefaultStateFromProto:y,getCurrStateFromProto:b,updateWidgetMgrState:v,element:S,widgetMgr:w,fragmentId:O,onFormCleared:E}),$=(0,i.u)(),k=(0,n.useCallback)((e=>{let{fromUi:t}=e;M({value:j,fromUi:t}),P(!1)}),[j,M]),_=(0,n.useCallback)((()=>{I&&k({fromUi:!0}),W(!1)}),[I,k]),A=(0,n.useCallback)((()=>{W(!0)}),[]),D=(0,n.useCallback)((e=>{const{value:t}=e.target,{maxChars:r}=S;0!==r&&t.length>r||(x(t),P(!0))}),[S]),R=(0,n.useCallback)((e=>{const{metaKey:t,ctrlKey:r}=e,{formId:n}=S,o=w.allowFormEnterToSubmit(n);(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)&&(r||t)&&I&&(e.preventDefault(),k({fromUi:!0}),o&&w.submitForm(n,O))}),[S,w,I,k,O]),L={width:C},{height:z,placeholder:B,formId:U}=S,N=(0,p.Ml)({formId:U})?w.allowFormEnterToSubmit(U):I,K=T&&C>$.breakpoints.hideWidgetDetails,V=z&&z<95?`${z}px`:"95px";return(0,g.jsxs)("div",{className:"stTextArea","data-testid":"stTextArea",style:L,children:[(0,g.jsx)(u.L,{label:S.label,disabled:a,labelVisibility:(0,p.yv)(null===(r=S.labelVisibility)||void 0===r?void 0:r.value),htmlFor:F,children:S.help&&(0,g.jsx)(c.j,{children:(0,g.jsx)(d.A,{content:S.help,placement:f.W.TOP_RIGHT})})}),(0,g.jsx)(o.A,{value:null!==j&&void 0!==j?j:"",placeholder:B,onBlur:_,onFocus:A,onChange:D,onKeyDown:R,"aria-label":S.label,disabled:a,id:F,overrides:{Input:{style:{lineHeight:$.lineHeights.inputWidget,height:z?`${z}px`:"",minHeight:V,resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:$.spacing.lg,paddingLeft:$.spacing.lg,paddingBottom:$.spacing.lg,paddingTop:$.spacing.lg}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:{borderLeftWidth:$.sizes.borderWidth,borderRightWidth:$.sizes.borderWidth,borderTopWidth:$.sizes.borderWidth,borderBottomWidth:$.sizes.borderWidth}}}}),K&&(0,g.jsx)(s.A,{dirty:I,value:null!==j&&void 0!==j?j:"",maxLength:S.maxChars,type:"multiline",inForm:(0,p.Ml)({formId:U}),allowEnterToSubmit:N})]})}},3101:(e,t,r)=>{"use strict";r.d(t,{_:()=>a,t:()=>l});var n=r(58878),o=r(34752),i=r(25571);function a(e){let{getStateFromWidgetMgr:t,getDefaultState:r,updateWidgetMgrState:a,element:l,widgetMgr:s,fragmentId:u,onFormCleared:c}=e;const[d,f]=(0,n.useState)((()=>{var e;return null!==(e=t(s,l))&&void 0!==e?e:r(s,l)})),[p,m]=(0,n.useState)({value:d,fromUi:!1});(0,n.useEffect)((()=>{(0,i.hX)(p)||(m(null),f(p.value),a(l,s,p,u))}),[p,a,l,s,u]);const g=(0,n.useCallback)((()=>{m({value:r(s,l),fromUi:!0}),null===c||void 0===c||c()}),[m,l,r,s,c]);return(0,o.X)({widgetMgr:s,element:l,onFormCleared:g}),[d,m]}function l(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:r,getCurrStateFromProto:o,updateWidgetMgrState:i,element:l,widgetMgr:s,fragmentId:u,onFormCleared:c}=e;const d=(0,n.useCallback)(((e,t)=>r(t)),[r]),[f,p]=a({getStateFromWidgetMgr:t,getDefaultState:d,updateWidgetMgrState:i,element:l,widgetMgr:s,fragmentId:u,onFormCleared:c});return(0,n.useEffect)((()=>{l.setValue&&(l.setValue=!1,p({value:o(l),fromUi:!1}))}),[l,o,p]),[f,p]}},94928:(e,t,r)=>{"use strict";r.d(t,{A:()=>x});var n=r(58878),o=r(35331),i=r(18648),a=r(92850),l=r(57224),s=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 f=(0,l.I4)("div",(function(e){return c(c({},(0,s.vt)(c(c({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})}));f.displayName="StyledTextAreaRoot",f.displayName="StyledTextAreaRoot";var p=(0,l.I4)("div",(function(e){return(0,s.EO)(c({$positive:!1},e))}));p.displayName="StyledTextareaContainer",p.displayName="StyledTextareaContainer";var m=(0,l.I4)("textarea",(function(e){return c(c({},(0,s.n)(e)),{},{resize:e.$resize||"none"})}));function g(e){return g="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},g(e)}function h(){return h=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},h.apply(this,arguments)}function y(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,l=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(s){l=!0,o=s}finally{try{a||null==r.return||r.return()}finally{if(l)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return b(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 b(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 b(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 S(e,t){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},S(e,t)}function w(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=C(e);if(t){var o=C(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===g(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 C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},C(e)}function F(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}m.displayName="StyledTextarea",m.displayName="StyledTextarea";var j=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&&S(e,t)}(u,e);var t,r,l,s=w(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 F(O(e=s.call.apply(s,[this].concat(r))),"state",{isFocused:e.props.autoFocus||!1}),F(O(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t)})),F(O(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=y((0,o._O)(t.Root,f),2),l=r[0],s=r[1],u=(0,o.Qp)({Input:{component:m},InputContainer:{component:p}},t);return n.createElement(l,h({"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},s),n.createElement(i.A,h({},this.props,{type:a.GT.textarea,overrides:u,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}])&&v(t.prototype,r),l&&v(t,l),Object.defineProperty(t,"prototype",{writable:!1}),u}(n.Component);F(j,"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 x=j},32698:(e,t,r)=>{var n=r(30136),o=0;e.exports=function(e){var t=++o;return n(e)+t}}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[5625],{15625:(e,t,r)=>{r.r(t),r.d(t,{default:()=>B});var n=r(58878),o=r(8151),i=Object.freeze({radio:"radio",checkbox:"checkbox"}),l=(Object.freeze({change:"change"}),"default"),a=r(35331),c=r(65266),u=(0,r(57224).I4)("div",(function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=1===r?void 0:t!==l?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}}));function s(e){return s="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},s(e)}function f(){return f=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},f.apply(this,arguments)}function d(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 p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){O(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function g(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=[],l=!0,a=!1;try{for(r=r.call(e);!(l=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(c){a=!0,o=c}finally{try{l||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 y(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 y(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 y(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 m(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 b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function h(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=S(e);if(t){var o=S(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===s(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}(this,r)}}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}u.displayName="StyledRoot",u.displayName="StyledRoot";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&&b(e,t)}(d,e);var t,r,o,s=h(d);function d(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return O(v(e=s.call.apply(s,[this].concat(r))),"childRefs",{}),e}return t=d,r=[{key:"render",value:function(){var e=this,t=this.props,r=t.overrides,o=void 0===r?{}:r,s=t.mode,d=void 0===s?i.checkbox:s,y=t.children,m=t.selected,b=t.disabled,h=t.onClick,v=t.kind,S=t.shape,O=t.size,C=g((0,a._O)(o.Root,u),2),w=C[0],L=C[1],j=this.props["aria-label"]||this.props.ariaLabel,E=d===i.radio,k=n.Children.count(y);return n.createElement(c.U.Consumer,null,(function(t){return n.createElement(w,f({"aria-label":j||t.buttongroup.ariaLabel,"data-baseweb":"button-group",role:E?"radiogroup":"group",$shape:S,$length:y.length},L),n.Children.map(y,(function(t,r){if(!n.isValidElement(t))return null;var o=t.props.isSelected?t.props.isSelected:function(e,t){return!(!Array.isArray(e)&&"number"!==typeof e)&&(Array.isArray(e)?e.includes(t):e===t)}(m,r);return E&&(e.childRefs[r]=n.createRef()),n.cloneElement(t,{disabled:b||t.props.disabled,isSelected:o,ref:E?e.childRefs[r]:void 0,tabIndex:!E||o||E&&(!m||-1===m)&&0===r?0:-1,onKeyDown:function(t){if(E){var r=Number(m)?Number(m):0;if("ArrowUp"===t.key||"ArrowLeft"===t.key){t.preventDefault&&t.preventDefault();var n=r-1<0?k-1:r-1;h&&h(t,n),e.childRefs[n].current&&e.childRefs[n].current.focus()}if("ArrowDown"===t.key||"ArrowRight"===t.key){t.preventDefault&&t.preventDefault();var o=r+1>k-1?0:r+1;h&&h(t,o),e.childRefs[o].current&&e.childRefs[o].current.focus()}}},kind:v,onClick:function(e){b||(t.props.onClick&&t.props.onClick(e),h&&h(e,r))},shape:S,size:O,overrides:p({BaseButton:{style:function(e){var t=e.$theme;return 1===y.length?{}:S!==l?{marginLeft:t.sizing.scale100,marginRight:t.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":o,role:E?"radio":"checkbox"}}},t.props.overrides)})})))}))}}],r&&m(t.prototype,r),o&&m(t,o),Object.defineProperty(t,"prototype",{writable:!1}),d}(n.Component);O(C,"defaultProps",{disabled:!1,onClick:function(){},shape:l,size:"default",kind:"secondary"});var w=r(34914),L=r(84720),j=r(36459),E=r(94426),k=r(29669),M=r(70474),R=r(78286),I=r(93480),P=r(997),x=r(25571),_=r(3101),A=r(90782);function D(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function F(e,t,r,o,i,l){const a=function(e,t,r,n){return r.indexOf(n)>-1||t===k.e2.ClickMode.SINGLE_SELECT&&e===k.e2.SelectionVisualization.ALL_UP_TO_SELECTED&&r.length>0&&n<r[0]}(r,o,i,t);let c=e.content,u=e.contentIcon;return a&&(c=e.selectedContent?e.selectedContent:c,u=e.selectedContentIcon?e.selectedContentIcon:u),(0,n.forwardRef)((function(t,r){var n,o;const{element:i,kind:s,size:f}=function(e,t,r){const n=r===k.e2.Style.PILLS?L.KX.PILLS:r===k.e2.Style.BORDERLESS?L.KX.BORDERLESS_ICON:L.KX.SEGMENT,o=r===k.e2.Style.BORDERLESS?L.Pj.XSMALL:L.Pj.MEDIUM,i=r===k.e2.Style.BORDERLESS?"lg":"base";return{element:(0,A.jsxs)(A.Fragment,{children:[t&&(0,A.jsx)(E.$,{size:i,iconValue:t}),e&&(0,A.jsx)(w.Ay,{source:e,allowHTML:!1})]}),kind:n,size:o}}(null!==(n=c)&&void 0!==n?n:"",null!==(o=u)&&void 0!==o?o:void 0,l),d=function(e,t){return e&&(t=`${t}Active`),t}(!(!a||e.selectedContent||e.selectedContentIcon),s);return(0,A.jsx)(j.Ay,{...t,size:f,kind:d,children:i})}))}function T(e,t){return e.getIntArrayValue(t)}function z(e){var t;return null!==(t=e.default)&&void 0!==t?t:null}function U(e){var t;return null!==(t=e.value)&&void 0!==t?t:null}function W(e){var t;const{disabled:r,element:l,fragmentId:a,widgetMgr:c}=e,{clickMode:u,options:s,selectionVisualization:f,style:d,label:p,labelVisibility:g,help:y}=l,m=(0,o.u)(),[b,h]=(0,_.t)({getStateFromWidgetMgr:T,getDefaultStateFromProto:z,getCurrStateFromProto:U,updateWidgetMgrState:D,element:l,widgetMgr:c,fragmentId:a});let v;u===k.e2.ClickMode.SINGLE_SELECT?v=i.radio:u===k.e2.ClickMode.MULTI_SELECT&&(v=i.checkbox);const S=(0,n.useMemo)((()=>s.map(((e,t)=>{const r=F(e,t,f,u,b,d);return(0,A.jsx)(r,{},`${e.content}-${t}`)}))),[u,s,f,d,b]),O=d===k.e2.Style.BORDERLESS?m.spacing.threeXS:m.spacing.twoXS;return(0,A.jsxs)("div",{className:"stButtonGroup","data-testid":"stButtonGroup",children:[(0,A.jsx)(M.L,{label:p,disabled:r,labelVisibility:(0,x.yv)(null!==(t=null===g||void 0===g?void 0:g.value)&&void 0!==t?t:k.Qx.LabelVisibilityOptions.COLLAPSED),children:y&&(0,A.jsx)(R.Cl,{children:(0,A.jsx)(I.A,{content:y,placement:P.W.TOP})})}),(0,A.jsx)(C,{disabled:r,mode:v,onClick:(e,t)=>{const r=function(e,t,r){return e==k.e2.ClickMode.MULTI_SELECT?function(e,t){return t.includes(e)?t.filter((t=>t!==e)):[...t,e]}(t,null!==r&&void 0!==r?r:[]):null!==r&&void 0!==r&&r.includes(t)?[]:[t]}(u,t,b);h({value:r,fromUi:!0})},selected:u===k.e2.ClickMode.MULTI_SELECT?b:(w=b,0===w.length?-1:w[0]),overrides:{Root:{style:{flexWrap:"wrap",gap:O}}},children:S})]});var w}const B=(0,n.memo)(W)},34752:(e,t,r)=>{r.d(t,{X:()=>l,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 l(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])}},3101:(e,t,r)=>{r.d(t,{_:()=>l,t:()=>a});var n=r(58878),o=r(34752),i=r(25571);function l(e){let{getStateFromWidgetMgr:t,getDefaultState:r,updateWidgetMgrState:l,element:a,widgetMgr:c,fragmentId:u}=e;const[s,f]=(0,n.useState)((()=>{var e;return null!==(e=t(c,a))&&void 0!==e?e:r(c,a)})),[d,p]=(0,n.useState)({value:s,fromUi:!1});(0,n.useEffect)((()=>{(0,i.hX)(d)||(p(null),f(d.value),l(a,c,d,u))}),[d,l,a,c,u]);const g=(0,n.useCallback)((()=>{p({value:r(c,a),fromUi:!0})}),[p,a,r,c]);return(0,o.X)({widgetMgr:c,element:a,onFormCleared:g}),[s,p]}function a(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:r,getCurrStateFromProto:o,updateWidgetMgrState:i,element:a,widgetMgr:c,fragmentId:u}=e;const s=(0,n.useCallback)(((e,t)=>r(t)),[r]),[f,d]=l({getStateFromWidgetMgr:t,getDefaultState:s,updateWidgetMgrState:i,element:a,widgetMgr:c,fragmentId:u});return(0,n.useEffect)((()=>{a.setValue&&(a.setValue=!1,d({value:o(a),fromUi:!1}))}),[a,o,d]),[f,d]}}}]);
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[5625],{15625:(e,t,r)=>{r.r(t),r.d(t,{default:()=>B});var n=r(58878),o=r(8151),i=Object.freeze({radio:"radio",checkbox:"checkbox"}),l=(Object.freeze({change:"change"}),"default"),a=r(35331),c=r(65266),u=(0,r(57224).I4)("div",(function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=1===r?void 0:t!==l?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}}));function s(e){return s="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},s(e)}function f(){return f=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},f.apply(this,arguments)}function d(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 p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){O(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function g(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=[],l=!0,a=!1;try{for(r=r.call(e);!(l=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(c){a=!0,o=c}finally{try{l||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 y(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 y(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 y(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 m(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 b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function h(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=S(e);if(t){var o=S(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===s(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}(this,r)}}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}u.displayName="StyledRoot",u.displayName="StyledRoot";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&&b(e,t)}(d,e);var t,r,o,s=h(d);function d(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return O(v(e=s.call.apply(s,[this].concat(r))),"childRefs",{}),e}return t=d,r=[{key:"render",value:function(){var e=this,t=this.props,r=t.overrides,o=void 0===r?{}:r,s=t.mode,d=void 0===s?i.checkbox:s,y=t.children,m=t.selected,b=t.disabled,h=t.onClick,v=t.kind,S=t.shape,O=t.size,C=g((0,a._O)(o.Root,u),2),w=C[0],L=C[1],j=this.props["aria-label"]||this.props.ariaLabel,E=d===i.radio,k=n.Children.count(y);return n.createElement(c.U.Consumer,null,(function(t){return n.createElement(w,f({"aria-label":j||t.buttongroup.ariaLabel,"data-baseweb":"button-group",role:E?"radiogroup":"group",$shape:S,$length:y.length},L),n.Children.map(y,(function(t,r){if(!n.isValidElement(t))return null;var o=t.props.isSelected?t.props.isSelected:function(e,t){return!(!Array.isArray(e)&&"number"!==typeof e)&&(Array.isArray(e)?e.includes(t):e===t)}(m,r);return E&&(e.childRefs[r]=n.createRef()),n.cloneElement(t,{disabled:b||t.props.disabled,isSelected:o,ref:E?e.childRefs[r]:void 0,tabIndex:!E||o||E&&(!m||-1===m)&&0===r?0:-1,onKeyDown:function(t){if(E){var r=Number(m)?Number(m):0;if("ArrowUp"===t.key||"ArrowLeft"===t.key){t.preventDefault&&t.preventDefault();var n=r-1<0?k-1:r-1;h&&h(t,n),e.childRefs[n].current&&e.childRefs[n].current.focus()}if("ArrowDown"===t.key||"ArrowRight"===t.key){t.preventDefault&&t.preventDefault();var o=r+1>k-1?0:r+1;h&&h(t,o),e.childRefs[o].current&&e.childRefs[o].current.focus()}}},kind:v,onClick:function(e){b||(t.props.onClick&&t.props.onClick(e),h&&h(e,r))},shape:S,size:O,overrides:p({BaseButton:{style:function(e){var t=e.$theme;return 1===y.length?{}:S!==l?{marginLeft:t.sizing.scale100,marginRight:t.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":o,role:E?"radio":"checkbox"}}},t.props.overrides)})})))}))}}],r&&m(t.prototype,r),o&&m(t,o),Object.defineProperty(t,"prototype",{writable:!1}),d}(n.Component);O(C,"defaultProps",{disabled:!1,onClick:function(){},shape:l,size:"default",kind:"secondary"});var w=r(34914),L=r(84720),j=r(36459),E=r(94426),k=r(29669),M=r(70474),R=r(78286),I=r(93480),P=r(997),x=r(25571),_=r(3101),A=r(90782);function D(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function F(e,t,r,o,i,l){const a=function(e,t,r,n){return r.indexOf(n)>-1||t===k.e2.ClickMode.SINGLE_SELECT&&e===k.e2.SelectionVisualization.ALL_UP_TO_SELECTED&&r.length>0&&n<r[0]}(r,o,i,t);let c=e.content,u=e.contentIcon;return a&&(c=e.selectedContent?e.selectedContent:c,u=e.selectedContentIcon?e.selectedContentIcon:u),(0,n.forwardRef)((function(t,r){var n,o;const{element:i,kind:s,size:f}=function(e,t,r){const n=r===k.e2.Style.PILLS?L.KX.PILLS:r===k.e2.Style.BORDERLESS?L.KX.BORDERLESS_ICON:L.KX.SEGMENT,o=r===k.e2.Style.BORDERLESS?L.Pj.XSMALL:L.Pj.MEDIUM,i=r===k.e2.Style.BORDERLESS?"lg":"base";return{element:(0,A.jsxs)(A.Fragment,{children:[t&&(0,A.jsx)(E.$,{size:i,iconValue:t}),e&&(0,A.jsx)(w.Ay,{source:e,allowHTML:!1})]}),kind:n,size:o}}(null!==(n=c)&&void 0!==n?n:"",null!==(o=u)&&void 0!==o?o:void 0,l),d=function(e,t){return e&&(t=`${t}Active`),t}(!(!a||e.selectedContent||e.selectedContentIcon),s);return(0,A.jsx)(j.Ay,{...t,size:f,kind:d,children:i})}))}function T(e,t){return e.getIntArrayValue(t)}function z(e){var t;return null!==(t=e.default)&&void 0!==t?t:null}function U(e){var t;return null!==(t=e.value)&&void 0!==t?t:null}function W(e){var t;const{disabled:r,element:l,fragmentId:a,widgetMgr:c}=e,{clickMode:u,options:s,selectionVisualization:f,style:d,label:p,labelVisibility:g,help:y}=l,m=(0,o.u)(),[b,h]=(0,_.t)({getStateFromWidgetMgr:T,getDefaultStateFromProto:z,getCurrStateFromProto:U,updateWidgetMgrState:D,element:l,widgetMgr:c,fragmentId:a});let v;u===k.e2.ClickMode.SINGLE_SELECT?v=i.radio:u===k.e2.ClickMode.MULTI_SELECT&&(v=i.checkbox);const S=(0,n.useMemo)((()=>s.map(((e,t)=>{const r=F(e,t,f,u,b,d);return(0,A.jsx)(r,{},`${e.content}-${t}`)}))),[u,s,f,d,b]),O=d===k.e2.Style.BORDERLESS?m.spacing.threeXS:m.spacing.twoXS;return(0,A.jsxs)("div",{className:"stButtonGroup","data-testid":"stButtonGroup",children:[(0,A.jsx)(M.L,{label:p,disabled:r,labelVisibility:(0,x.yv)(null!==(t=null===g||void 0===g?void 0:g.value)&&void 0!==t?t:k.Qx.LabelVisibilityOptions.COLLAPSED),children:y&&(0,A.jsx)(R.Cl,{children:(0,A.jsx)(I.A,{content:y,placement:P.W.TOP})})}),(0,A.jsx)(C,{disabled:r,mode:v,onClick:(e,t)=>{const r=function(e,t,r){return e==k.e2.ClickMode.MULTI_SELECT?function(e,t){return t.includes(e)?t.filter((t=>t!==e)):[...t,e]}(t,null!==r&&void 0!==r?r:[]):null!==r&&void 0!==r&&r.includes(t)?[]:[t]}(u,t,b);h({value:r,fromUi:!0})},selected:u===k.e2.ClickMode.MULTI_SELECT?b:(w=b,0===w.length?-1:w[0]),overrides:{Root:{style:{flexWrap:"wrap",gap:O}}},children:S})]});var w}const B=(0,n.memo)(W)},34752:(e,t,r)=>{r.d(t,{X:()=>l,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 l(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])}},3101:(e,t,r)=>{r.d(t,{_:()=>l,t:()=>a});var n=r(58878),o=r(34752),i=r(25571);function l(e){let{getStateFromWidgetMgr:t,getDefaultState:r,updateWidgetMgrState:l,element:a,widgetMgr:c,fragmentId:u,onFormCleared:s}=e;const[f,d]=(0,n.useState)((()=>{var e;return null!==(e=t(c,a))&&void 0!==e?e:r(c,a)})),[p,g]=(0,n.useState)({value:f,fromUi:!1});(0,n.useEffect)((()=>{(0,i.hX)(p)||(g(null),d(p.value),l(a,c,p,u))}),[p,l,a,c,u]);const y=(0,n.useCallback)((()=>{g({value:r(c,a),fromUi:!0}),null===s||void 0===s||s()}),[g,a,r,c,s]);return(0,o.X)({widgetMgr:c,element:a,onFormCleared:y}),[f,g]}function a(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:r,getCurrStateFromProto:o,updateWidgetMgrState:i,element:a,widgetMgr:c,fragmentId:u,onFormCleared:s}=e;const f=(0,n.useCallback)(((e,t)=>r(t)),[r]),[d,p]=l({getStateFromWidgetMgr:t,getDefaultState:f,updateWidgetMgrState:i,element:a,widgetMgr:c,fragmentId:u,onFormCleared:s});return(0,n.useEffect)((()=>{a.setValue&&(a.setValue=!1,p({value:o(a),fromUi:!1}))}),[a,o,p]),[d,p]}}}]);
|