streamlit-nightly 1.35.1.dev20240530__py2.py3-none-any.whl → 1.35.1.dev20240531__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/__init__.py +2 -0
- streamlit/commands/execution_control.py +23 -13
- streamlit/commands/navigation.py +191 -0
- streamlit/components/v1/custom_component.py +2 -2
- streamlit/elements/media.py +2 -2
- streamlit/elements/plotly_chart.py +1 -1
- streamlit/elements/widgets/button.py +49 -40
- streamlit/elements/widgets/camera_input.py +1 -1
- streamlit/elements/widgets/chat.py +1 -1
- streamlit/elements/widgets/checkbox.py +1 -1
- streamlit/elements/widgets/color_picker.py +1 -1
- streamlit/elements/widgets/data_editor.py +1 -1
- streamlit/elements/widgets/file_uploader.py +1 -1
- streamlit/elements/widgets/multiselect.py +1 -1
- streamlit/elements/widgets/number_input.py +1 -1
- streamlit/elements/widgets/radio.py +1 -1
- streamlit/elements/widgets/select_slider.py +1 -1
- streamlit/elements/widgets/selectbox.py +1 -1
- streamlit/elements/widgets/slider.py +1 -1
- streamlit/elements/widgets/text_widgets.py +2 -2
- streamlit/elements/widgets/time_widgets.py +2 -2
- streamlit/navigation/__init__.py +13 -0
- streamlit/navigation/page.py +197 -0
- streamlit/proto/AppPage_pb2.py +3 -3
- streamlit/proto/AppPage_pb2.pyi +11 -1
- streamlit/proto/ForwardMsg_pb2.py +10 -9
- streamlit/proto/ForwardMsg_pb2.pyi +17 -5
- streamlit/proto/Navigation_pb2.py +29 -0
- streamlit/proto/Navigation_pb2.pyi +79 -0
- streamlit/proto/NewSession_pb2.py +24 -24
- streamlit/proto/NewSession_pb2.pyi +5 -1
- streamlit/runtime/app_session.py +35 -21
- streamlit/runtime/fragment.py +18 -2
- streamlit/runtime/pages_manager.py +354 -0
- streamlit/runtime/scriptrunner/script_run_context.py +13 -2
- streamlit/runtime/scriptrunner/script_runner.py +23 -37
- streamlit/source_util.py +25 -11
- streamlit/static/asset-manifest.json +4 -4
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/8571.cfc22b99.chunk.js +1 -0
- streamlit/static/static/js/9945.47d54f35.chunk.js +2 -0
- streamlit/static/static/js/{main.9978e612.js → main.707da454.js} +2 -2
- streamlit/testing/v1/app_test.py +7 -1
- streamlit/testing/v1/local_script_runner.py +6 -1
- streamlit/watcher/local_sources_watcher.py +20 -10
- streamlit/web/bootstrap.py +1 -19
- streamlit/web/server/routes.py +23 -25
- streamlit/web/server/server.py +9 -8
- {streamlit_nightly-1.35.1.dev20240530.dist-info → streamlit_nightly-1.35.1.dev20240531.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.35.1.dev20240530.dist-info → streamlit_nightly-1.35.1.dev20240531.dist-info}/RECORD +56 -50
- streamlit/static/static/js/5117.04bfe5d3.chunk.js +0 -1
- streamlit/static/static/js/6950.70fe55c2.chunk.js +0 -2
- /streamlit/static/static/js/{6950.70fe55c2.chunk.js.LICENSE.txt → 9945.47d54f35.chunk.js.LICENSE.txt} +0 -0
- /streamlit/static/static/js/{main.9978e612.js.LICENSE.txt → main.707da454.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.35.1.dev20240530.data → streamlit_nightly-1.35.1.dev20240531.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.35.1.dev20240530.dist-info → streamlit_nightly-1.35.1.dev20240531.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.35.1.dev20240530.dist-info → streamlit_nightly-1.35.1.dev20240531.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.35.1.dev20240530.dist-info → streamlit_nightly-1.35.1.dev20240531.dist-info}/top_level.txt +0 -0
@@ -52,6 +52,7 @@ from streamlit.vendor.ipython.modified_sys_path import modified_sys_path
|
|
52
52
|
|
53
53
|
if TYPE_CHECKING:
|
54
54
|
from streamlit.runtime.fragment import FragmentStorage
|
55
|
+
from streamlit.runtime.pages_manager import PagesManager
|
55
56
|
|
56
57
|
_LOGGER: Final = get_logger(__name__)
|
57
58
|
|
@@ -115,6 +116,7 @@ class ScriptRunner:
|
|
115
116
|
initial_rerun_data: RerunData,
|
116
117
|
user_info: dict[str, str | None],
|
117
118
|
fragment_storage: "FragmentStorage",
|
119
|
+
pages_manager: "PagesManager",
|
118
120
|
):
|
119
121
|
"""Initialize the ScriptRunner.
|
120
122
|
|
@@ -164,6 +166,7 @@ class ScriptRunner:
|
|
164
166
|
self._user_info = user_info
|
165
167
|
self._fragment_storage = fragment_storage
|
166
168
|
|
169
|
+
self._pages_manager = pages_manager
|
167
170
|
self._requests = ScriptRequests()
|
168
171
|
self._requests.request_rerun(initial_rerun_data)
|
169
172
|
|
@@ -291,10 +294,10 @@ class ScriptRunner:
|
|
291
294
|
session_state=self._session_state,
|
292
295
|
uploaded_file_mgr=self._uploaded_file_mgr,
|
293
296
|
main_script_path=self._main_script_path,
|
294
|
-
page_script_hash="",
|
295
297
|
user_info=self._user_info,
|
296
298
|
gather_usage_stats=bool(config.get_option("browser.gatherUsageStats")),
|
297
299
|
fragment_storage=self._fragment_storage,
|
300
|
+
pages_manager=self._pages_manager,
|
298
301
|
)
|
299
302
|
add_script_run_ctx(threading.current_thread(), ctx)
|
300
303
|
|
@@ -426,39 +429,18 @@ class ScriptRunner:
|
|
426
429
|
# Reset DeltaGenerators, widgets, media files.
|
427
430
|
runtime.get_instance().media_file_mgr.clear_session_refs()
|
428
431
|
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
432
|
+
self._pages_manager.set_script_intent(
|
433
|
+
rerun_data.page_script_hash, rerun_data.page_name
|
434
|
+
)
|
435
|
+
active_script = self._pages_manager.get_initial_active_script(
|
436
|
+
rerun_data.page_script_hash, rerun_data.page_name
|
437
|
+
)
|
438
|
+
main_page_info = self._pages_manager.get_main_page()
|
434
439
|
uncaught_exception = None
|
435
440
|
|
436
|
-
if rerun_data.page_script_hash:
|
437
|
-
current_page_info = pages.get(rerun_data.page_script_hash, None)
|
438
|
-
elif not rerun_data.page_script_hash and rerun_data.page_name:
|
439
|
-
# If a user navigates directly to a non-main page of an app, we get
|
440
|
-
# the first script run request before the list of pages has been
|
441
|
-
# sent to the frontend. In this case, we choose the first script
|
442
|
-
# with a name matching the requested page name.
|
443
|
-
current_page_info = next(
|
444
|
-
filter(
|
445
|
-
# There seems to be this weird bug with mypy where it
|
446
|
-
# thinks that p can be None (which is impossible given the
|
447
|
-
# types of pages), so we add `p and` at the beginning of
|
448
|
-
# the predicate to circumvent this.
|
449
|
-
lambda p: p and (p["page_name"] == rerun_data.page_name),
|
450
|
-
pages.values(),
|
451
|
-
),
|
452
|
-
None,
|
453
|
-
)
|
454
|
-
else:
|
455
|
-
# If no information about what page to run is given, default to
|
456
|
-
# running the main page.
|
457
|
-
current_page_info = main_page_info
|
458
|
-
|
459
441
|
page_script_hash = (
|
460
|
-
|
461
|
-
if
|
442
|
+
active_script["page_script_hash"]
|
443
|
+
if active_script is not None
|
462
444
|
else main_page_info["page_script_hash"]
|
463
445
|
)
|
464
446
|
|
@@ -488,16 +470,18 @@ class ScriptRunner:
|
|
488
470
|
event=ScriptRunnerEvent.SCRIPT_STARTED,
|
489
471
|
page_script_hash=page_script_hash,
|
490
472
|
fragment_ids_this_run=fragment_ids_this_run,
|
473
|
+
pages=self._pages_manager.get_pages(),
|
491
474
|
)
|
492
475
|
|
493
476
|
# Compile the script. Any errors thrown here will be surfaced
|
494
477
|
# to the user via a modal dialog in the frontend, and won't result
|
495
478
|
# in their previous script elements disappearing.
|
496
479
|
try:
|
497
|
-
if
|
498
|
-
script_path =
|
480
|
+
if active_script is not None:
|
481
|
+
script_path = active_script["script_path"]
|
499
482
|
else:
|
500
|
-
|
483
|
+
# page must not be found
|
484
|
+
script_path = main_page_info["script_path"]
|
501
485
|
|
502
486
|
# At this point, we know that either
|
503
487
|
# * the script corresponding to the hash requested no longer
|
@@ -646,9 +630,11 @@ class ScriptRunner:
|
|
646
630
|
ctx.tracked_commands,
|
647
631
|
exec_time=to_microseconds(timer() - start_time),
|
648
632
|
prep_time=to_microseconds(prep_time),
|
649
|
-
uncaught_exception=
|
650
|
-
|
651
|
-
|
633
|
+
uncaught_exception=(
|
634
|
+
type(uncaught_exception).__name__
|
635
|
+
if uncaught_exception
|
636
|
+
else None
|
637
|
+
),
|
652
638
|
)
|
653
639
|
)
|
654
640
|
except Exception as ex:
|
streamlit/source_util.py
CHANGED
@@ -17,9 +17,10 @@ from __future__ import annotations
|
|
17
17
|
import re
|
18
18
|
import threading
|
19
19
|
from pathlib import Path
|
20
|
-
from typing import Any, Callable, Final, cast
|
20
|
+
from typing import Any, Callable, Final, TypedDict, cast
|
21
21
|
|
22
22
|
from blinker import Signal
|
23
|
+
from typing_extensions import NotRequired, TypeAlias
|
23
24
|
|
24
25
|
from streamlit.logger import get_logger
|
25
26
|
from streamlit.string_util import extract_leading_emoji
|
@@ -27,6 +28,19 @@ from streamlit.util import calc_md5
|
|
27
28
|
|
28
29
|
_LOGGER: Final = get_logger(__name__)
|
29
30
|
|
31
|
+
PageHash: TypeAlias = str
|
32
|
+
PageName: TypeAlias = str
|
33
|
+
ScriptPath: TypeAlias = str
|
34
|
+
Icon: TypeAlias = str
|
35
|
+
|
36
|
+
|
37
|
+
class PageInfo(TypedDict):
|
38
|
+
script_path: ScriptPath
|
39
|
+
page_script_hash: PageHash
|
40
|
+
icon: NotRequired[Icon]
|
41
|
+
page_name: NotRequired[PageName]
|
42
|
+
url_pathname: NotRequired[str]
|
43
|
+
|
30
44
|
|
31
45
|
def open_python_file(filename: str):
|
32
46
|
"""Open a read-only Python file taking proper care of its encoding.
|
@@ -91,7 +105,7 @@ def page_icon_and_name(script_path: Path) -> tuple[str, str]:
|
|
91
105
|
|
92
106
|
|
93
107
|
_pages_cache_lock = threading.RLock()
|
94
|
-
_cached_pages: dict[
|
108
|
+
_cached_pages: dict[PageHash, PageInfo] | None = None
|
95
109
|
_on_pages_changed = Signal(doc="Emitted when the pages directory is changed")
|
96
110
|
|
97
111
|
|
@@ -105,13 +119,13 @@ def invalidate_pages_cache() -> None:
|
|
105
119
|
_on_pages_changed.send()
|
106
120
|
|
107
121
|
|
108
|
-
def get_pages(main_script_path_str:
|
122
|
+
def get_pages(main_script_path_str: ScriptPath) -> dict[PageHash, PageInfo]:
|
109
123
|
global _cached_pages
|
110
124
|
|
111
125
|
# Avoid taking the lock if the pages cache hasn't been invalidated.
|
112
|
-
|
113
|
-
if
|
114
|
-
return
|
126
|
+
precached_pages = _cached_pages
|
127
|
+
if precached_pages is not None:
|
128
|
+
return precached_pages
|
115
129
|
|
116
130
|
with _pages_cache_lock:
|
117
131
|
# The cache may have been repopulated while we were waiting to grab
|
@@ -121,14 +135,14 @@ def get_pages(main_script_path_str: str) -> dict[str, dict[str, str]]:
|
|
121
135
|
|
122
136
|
main_script_path = Path(main_script_path_str)
|
123
137
|
main_page_icon, main_page_name = page_icon_and_name(main_script_path)
|
124
|
-
|
138
|
+
main_script_hash = calc_md5(main_script_path_str)
|
125
139
|
|
126
|
-
# NOTE: We include the
|
140
|
+
# NOTE: We include the script_hash in the dict even though it is
|
127
141
|
# already used as the key because that occasionally makes things
|
128
142
|
# easier for us when we need to iterate over pages.
|
129
|
-
pages = {
|
130
|
-
|
131
|
-
"page_script_hash":
|
143
|
+
pages: dict[PageHash, PageInfo] = {
|
144
|
+
main_script_hash: {
|
145
|
+
"page_script_hash": main_script_hash,
|
132
146
|
"page_name": main_page_name,
|
133
147
|
"icon": main_page_icon,
|
134
148
|
"script_path": str(main_script_path.resolve()),
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"files": {
|
3
3
|
"main.css": "./static/css/main.3aaaea00.css",
|
4
|
-
"main.js": "./static/js/main.
|
4
|
+
"main.js": "./static/js/main.707da454.js",
|
5
5
|
"static/js/9336.3e046ad7.chunk.js": "./static/js/9336.3e046ad7.chunk.js",
|
6
6
|
"static/js/9330.2b4c99e0.chunk.js": "./static/js/9330.2b4c99e0.chunk.js",
|
7
7
|
"static/js/2736.4336e2b9.chunk.js": "./static/js/2736.4336e2b9.chunk.js",
|
@@ -53,9 +53,9 @@
|
|
53
53
|
"static/js/3466.05d62820.chunk.js": "./static/js/3466.05d62820.chunk.js",
|
54
54
|
"static/js/7483.64f23be7.chunk.js": "./static/js/7483.64f23be7.chunk.js",
|
55
55
|
"static/js/5249.f2f4070d.chunk.js": "./static/js/5249.f2f4070d.chunk.js",
|
56
|
-
"static/js/
|
56
|
+
"static/js/9945.47d54f35.chunk.js": "./static/js/9945.47d54f35.chunk.js",
|
57
57
|
"static/js/5791.9a42fb4b.chunk.js": "./static/js/5791.9a42fb4b.chunk.js",
|
58
|
-
"static/js/
|
58
|
+
"static/js/8571.cfc22b99.chunk.js": "./static/js/8571.cfc22b99.chunk.js",
|
59
59
|
"static/js/2187.9469f035.chunk.js": "./static/js/2187.9469f035.chunk.js",
|
60
60
|
"static/js/1479.6709db03.chunk.js": "./static/js/1479.6709db03.chunk.js",
|
61
61
|
"static/js/329.464ed8ec.chunk.js": "./static/js/329.464ed8ec.chunk.js",
|
@@ -151,6 +151,6 @@
|
|
151
151
|
},
|
152
152
|
"entrypoints": [
|
153
153
|
"static/css/main.3aaaea00.css",
|
154
|
-
"static/js/main.
|
154
|
+
"static/js/main.707da454.js"
|
155
155
|
]
|
156
156
|
}
|
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.707da454.js"></script><link href="./static/css/main.3aaaea00.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([[8571],{31197:(e,t,n)=>{n.d(t,{U:()=>a});var r=n(25773),i=n(66845),o=n(69),a=i.forwardRef((function(e,t){return i.createElement(o.D,(0,r.Z)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),i.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),i.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"}))}));a.displayName="Clear"},74529:(e,t,n)=>{n.d(t,{n:()=>a});var r=n(25773),i=n(66845),o=n(69),a=i.forwardRef((function(e,t){return i.createElement(o.D,(0,r.Z)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),i.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),i.createElement("path",{d:"M19.35 10.04A7.49 7.49 0 0012 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 000 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95A5.469 5.469 0 0112 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11A2.98 2.98 0 0122 15c0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z"}))}));a.displayName="CloudUpload"},62288:(e,t,n)=>{n.d(t,{j:()=>a});var r=n(25773),i=n(66845),o=n(69),a=i.forwardRef((function(e,t){return i.createElement(o.D,(0,r.Z)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),i.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))}));a.displayName="Error"},87847:(e,t,n)=>{n.d(t,{h:()=>a});var r=n(25773),i=n(66845),o=n(69),a=i.forwardRef((function(e,t){return i.createElement(o.D,(0,r.Z)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),i.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),i.createElement("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z"}))}));a.displayName="InsertDriveFile"},1681:(e,t)=>{t.Z=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(","),r=e.name||"",i=(e.type||"").toLowerCase(),o=i.replace(/\/.*$/,"");return n.some((function(e){var t=e.trim().toLowerCase();return"."===t.charAt(0)?r.toLowerCase().endsWith(t):t.endsWith("/*")?o===t.replace(/\/.*$/,""):i===t}))}return!0}},51622:(e,t,n)=>{n.d(t,{ZP:()=>ie});var r=n(66845),i=n(8984),o=n.n(i),a=n(90406),c=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function l(e,t){var n=function(e){var t=e.name;if(t&&-1!==t.lastIndexOf(".")&&!e.type){var n=t.split(".").pop().toLowerCase(),r=c.get(n);r&&Object.defineProperty(e,"type",{value:r,writable:!1,configurable:!1,enumerable:!0})}return e}(e);if("string"!==typeof n.path){var r=e.webkitRelativePath;Object.defineProperty(n,"path",{value:"string"===typeof t?t:"string"===typeof r&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}var u=[".DS_Store","Thumbs.db"];function s(e){return"object"===typeof e&&null!==e}function f(e){return v(e.target.files).map((function(e){return l(e)}))}function p(e){return(0,a.mG)(this,void 0,void 0,(function(){return(0,a.Jh)(this,(function(t){switch(t.label){case 0:return[4,Promise.all(e.map((function(e){return e.getFile()})))];case 1:return[2,t.sent().map((function(e){return l(e)}))]}}))}))}function d(e,t){return(0,a.mG)(this,void 0,void 0,(function(){var n;return(0,a.Jh)(this,(function(r){switch(r.label){case 0:return null===e?[2,[]]:e.items?(n=v(e.items).filter((function(e){return"file"===e.kind})),"drop"!==t?[2,n]:[4,Promise.all(n.map(g))]):[3,2];case 1:return[2,m(y(r.sent()))];case 2:return[2,m(v(e.files).map((function(e){return l(e)})))]}}))}))}function m(e){return e.filter((function(e){return-1===u.indexOf(e.name)}))}function v(e){if(null===e)return[];for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r)}return t}function g(e){if("function"!==typeof e.webkitGetAsEntry)return b(e);var t=e.webkitGetAsEntry();return t&&t.isDirectory?w(t):b(e)}function y(e){return e.reduce((function(e,t){return(0,a.fl)(e,Array.isArray(t)?y(t):[t])}),[])}function b(e){var t=e.getAsFile();if(!t)return Promise.reject(e+" is not a File");var n=l(t);return Promise.resolve(n)}function h(e){return(0,a.mG)(this,void 0,void 0,(function(){return(0,a.Jh)(this,(function(t){return[2,e.isDirectory?w(e):D(e)]}))}))}function w(e){var t=e.createReader();return new Promise((function(e,n){var r=[];!function i(){var o=this;t.readEntries((function(t){return(0,a.mG)(o,void 0,void 0,(function(){var o,c,l;return(0,a.Jh)(this,(function(a){switch(a.label){case 0:if(t.length)return[3,5];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,Promise.all(r)];case 2:return o=a.sent(),e(o),[3,4];case 3:return c=a.sent(),n(c),[3,4];case 4:return[3,6];case 5:l=Promise.all(t.map(h)),r.push(l),i(),a.label=6;case 6:return[2]}}))}))}),(function(e){n(e)}))}()}))}function D(e){return(0,a.mG)(this,void 0,void 0,(function(){return(0,a.Jh)(this,(function(t){return[2,new Promise((function(t,n){e.file((function(n){var r=l(n,e.fullPath);t(r)}),(function(e){n(e)}))}))]}))}))}var x=n(1681);function O(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],a=!0,c=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(l){c=!0,i=l}finally{try{a||null==n.return||n.return()}finally{if(c)throw i}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return E(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 E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var k="file-invalid-type",C="file-too-large",z="file-too-small",P="too-many-files",S=function(e){e=Array.isArray(e)&&1===e.length?e[0]:e;var t=Array.isArray(e)?"one of ".concat(e.join(", ")):e;return{code:k,message:"File type must be ".concat(t)}},R=function(e){return{code:C,message:"File is larger than ".concat(e," ").concat(1===e?"byte":"bytes")}},M=function(e){return{code:z,message:"File is smaller than ".concat(e," ").concat(1===e?"byte":"bytes")}},T={code:P,message:"Too many files"};function I(e,t){var n="application/x-moz-file"===e.type||(0,x.Z)(e,t);return[n,n?null:S(t)]}function L(e,t,n){if(V(e.size))if(V(t)&&V(n)){if(e.size>n)return[!1,R(n)];if(e.size<t)return[!1,M(t)]}else{if(V(t)&&e.size<t)return[!1,M(t)];if(V(n)&&e.size>n)return[!1,R(n)]}return[!0,null]}function V(e){return void 0!==e&&null!==e}function B(e){return"function"===typeof e.isPropagationStopped?e.isPropagationStopped():"undefined"!==typeof e.cancelBubble&&e.cancelBubble}function K(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,(function(e){return"Files"===e||"application/x-moz-file"===e})):!!e.target&&!!e.target.files}function H(e){e.preventDefault()}function G(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return t.some((function(t){return!B(e)&&t&&t.apply(void 0,[e].concat(r)),B(e)}))}}function Z(e){return e="string"===typeof e?e.split(","):e,[{description:"everything",accept:Array.isArray(e)?e.filter((function(e){return"audio/*"===e||"video/*"===e||"image/*"===e||"text/*"===e||/\w+\/[-+.\w]+/g.test(e)})).reduce((function(e,t){return A(A({},e),{},j({},t,[]))}),{}):{}}]}var _=["children"],J=["open"],N=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],U=["refKey","onChange","onClick"];function $(e){return function(e){if(Array.isArray(e))return Y(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||W(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],a=!0,c=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(l){c=!0,i=l}finally{try{a||null==n.return||n.return()}finally{if(c)throw i}}return o}(e,t)||W(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 W(e,t){if(e){if("string"===typeof e)return Y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Y(e,t):void 0}}function Y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function X(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(n),!0).forEach((function(t){ee(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function te(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var ne=(0,r.forwardRef)((function(e,t){var n=e.children,i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=X(X({},re),e),n=t.accept,i=t.disabled,o=t.getFilesFromEvent,a=t.maxSize,c=t.minSize,l=t.multiple,u=t.maxFiles,s=t.onDragEnter,f=t.onDragLeave,p=t.onDragOver,d=t.onDrop,m=t.onDropAccepted,v=t.onDropRejected,g=t.onFileDialogCancel,y=t.onFileDialogOpen,b=t.useFsAccessApi,h=t.preventDropOnDocument,w=t.noClick,D=t.noKeyboard,x=t.noDrag,O=t.noDragEventsBubbling,A=t.validator,j=(0,r.useMemo)((function(){return"function"===typeof y?y:ce}),[y]),E=(0,r.useMemo)((function(){return"function"===typeof g?g:ce}),[g]),k=(0,r.useRef)(null),C=(0,r.useRef)(null),z=q((0,r.useReducer)(ae,oe),2),P=z[0],S=z[1],R=P.isFocused,M=P.isFileDialogActive,V=P.draggedFiles,_=(0,r.useRef)("undefined"!==typeof window&&window.isSecureContext&&b&&"showOpenFilePicker"in window),J=function(){!_.current&&M&&setTimeout((function(){C.current&&(C.current.files.length||(S({type:"closeDialog"}),E()))}),300)};(0,r.useEffect)((function(){return window.addEventListener("focus",J,!1),function(){window.removeEventListener("focus",J,!1)}}),[C,M,E,_]);var W=(0,r.useRef)([]),Y=function(e){k.current&&k.current.contains(e.target)||(e.preventDefault(),W.current=[])};(0,r.useEffect)((function(){return h&&(document.addEventListener("dragover",H,!1),document.addEventListener("drop",Y,!1)),function(){h&&(document.removeEventListener("dragover",H),document.removeEventListener("drop",Y))}}),[k,h]);var Q=(0,r.useCallback)((function(e){e.preventDefault(),e.persist(),be(e),W.current=[].concat($(W.current),[e.target]),K(e)&&Promise.resolve(o(e)).then((function(t){B(e)&&!O||(S({draggedFiles:t,isDragActive:!0,type:"setDraggedFiles"}),s&&s(e))}))}),[o,s,O]),ne=(0,r.useCallback)((function(e){e.preventDefault(),e.persist(),be(e);var t=K(e);if(t&&e.dataTransfer)try{e.dataTransfer.dropEffect="copy"}catch(n){}return t&&p&&p(e),!1}),[p,O]),ie=(0,r.useCallback)((function(e){e.preventDefault(),e.persist(),be(e);var t=W.current.filter((function(e){return k.current&&k.current.contains(e)})),n=t.indexOf(e.target);-1!==n&&t.splice(n,1),W.current=t,t.length>0||(S({isDragActive:!1,type:"setDraggedFiles",draggedFiles:[]}),K(e)&&f&&f(e))}),[k,f,O]),le=(0,r.useCallback)((function(e,t){var r=[],i=[];e.forEach((function(e){var t=q(I(e,n),2),o=t[0],l=t[1],u=q(L(e,c,a),2),s=u[0],f=u[1],p=A?A(e):null;if(o&&s&&!p)r.push(e);else{var d=[l,f];p&&(d=d.concat(p)),i.push({file:e,errors:d.filter((function(e){return e}))})}})),(!l&&r.length>1||l&&u>=1&&r.length>u)&&(r.forEach((function(e){i.push({file:e,errors:[T]})})),r.splice(0)),S({acceptedFiles:r,fileRejections:i,type:"setFiles"}),d&&d(r,i,t),i.length>0&&v&&v(i,t),r.length>0&&m&&m(r,t)}),[S,l,n,c,a,u,d,m,v,A]),ue=(0,r.useCallback)((function(e){e.preventDefault(),e.persist(),be(e),W.current=[],K(e)&&Promise.resolve(o(e)).then((function(t){B(e)&&!O||le(t,e)})),S({type:"reset"})}),[o,le,O]),se=(0,r.useCallback)((function(){if(_.current){S({type:"openDialog"}),j();var e={multiple:l,types:Z(n)};window.showOpenFilePicker(e).then((function(e){return o(e)})).then((function(e){le(e,null),S({type:"closeDialog"})})).catch((function(e){var t;(t=e)instanceof DOMException&&("AbortError"===t.name||t.code===t.ABORT_ERR)?(E(e),S({type:"closeDialog"})):function(e){return e instanceof DOMException&&("SecurityError"===e.name||e.code===e.SECURITY_ERR)}(e)&&(_.current=!1,C.current&&(C.current.value=null,C.current.click()))}))}else C.current&&(S({type:"openDialog"}),j(),C.current.value=null,C.current.click())}),[S,j,E,b,le,n,l]),fe=(0,r.useCallback)((function(e){k.current&&k.current.isEqualNode(e.target)&&(" "!==e.key&&"Enter"!==e.key&&32!==e.keyCode&&13!==e.keyCode||(e.preventDefault(),se()))}),[k,se]),pe=(0,r.useCallback)((function(){S({type:"focus"})}),[]),de=(0,r.useCallback)((function(){S({type:"blur"})}),[]),me=(0,r.useCallback)((function(){w||(!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.navigator.userAgent;return function(e){return-1!==e.indexOf("MSIE")||-1!==e.indexOf("Trident/")}(e)||function(e){return-1!==e.indexOf("Edge/")}(e)}()?se():setTimeout(se,0))}),[w,se]),ve=function(e){return i?null:e},ge=function(e){return D?null:ve(e)},ye=function(e){return x?null:ve(e)},be=function(e){O&&e.stopPropagation()},he=(0,r.useMemo)((function(){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.refKey,n=void 0===t?"ref":t,r=e.role,o=e.onKeyDown,a=e.onFocus,c=e.onBlur,l=e.onClick,u=e.onDragEnter,s=e.onDragOver,f=e.onDragLeave,p=e.onDrop,d=te(e,N);return X(X(ee({onKeyDown:ge(G(o,fe)),onFocus:ge(G(a,pe)),onBlur:ge(G(c,de)),onClick:ve(G(l,me)),onDragEnter:ye(G(u,Q)),onDragOver:ye(G(s,ne)),onDragLeave:ye(G(f,ie)),onDrop:ye(G(p,ue)),role:"string"===typeof r&&""!==r?r:"button"},n,k),i||D?{}:{tabIndex:0}),d)}}),[k,fe,pe,de,me,Q,ne,ie,ue,D,x,i]),we=(0,r.useCallback)((function(e){e.stopPropagation()}),[]),De=(0,r.useMemo)((function(){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.refKey,r=void 0===t?"ref":t,i=e.onChange,o=e.onClick,a=te(e,U);return X(X({},ee({accept:n,multiple:l,type:"file",style:{display:"none"},onChange:ve(G(i,ue)),onClick:ve(G(o,we)),tabIndex:-1},r,C)),a)}}),[C,n,l,ue,i]),xe=V.length,Oe=xe>0&&function(e){var t=e.files,n=e.accept,r=e.minSize,i=e.maxSize,o=e.multiple,a=e.maxFiles;return!(!o&&t.length>1||o&&a>=1&&t.length>a)&&t.every((function(e){var t=F(I(e,n),1)[0],o=F(L(e,r,i),1)[0];return t&&o}))}({files:V,accept:n,minSize:c,maxSize:a,multiple:l,maxFiles:u}),Ae=xe>0&&!Oe;return X(X({},P),{},{isDragAccept:Oe,isDragReject:Ae,isFocused:R&&!i,getRootProps:he,getInputProps:De,rootRef:k,inputRef:C,open:ve(se)})}(te(e,_)),o=i.open,a=te(i,J);return(0,r.useImperativeHandle)(t,(function(){return{open:o}}),[o]),r.createElement(r.Fragment,null,n(X(X({},a),{},{open:o})))}));ne.displayName="Dropzone";var re={disabled:!1,getFilesFromEvent:function(e){return(0,a.mG)(this,void 0,void 0,(function(){return(0,a.Jh)(this,(function(t){return s(e)&&s(e.dataTransfer)?[2,d(e.dataTransfer,e.type)]:function(e){return s(e)&&s(e.target)}(e)?[2,f(e)]:Array.isArray(e)&&e.every((function(e){return"getFile"in e&&"function"===typeof e.getFile}))?[2,p(e)]:[2,[]]}))}))},maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0};ne.defaultProps=re,ne.propTypes={children:o().func,accept:o().oneOfType([o().string,o().arrayOf(o().string)]),multiple:o().bool,preventDropOnDocument:o().bool,noClick:o().bool,noKeyboard:o().bool,noDrag:o().bool,noDragEventsBubbling:o().bool,minSize:o().number,maxSize:o().number,maxFiles:o().number,disabled:o().bool,getFilesFromEvent:o().func,onFileDialogCancel:o().func,onFileDialogOpen:o().func,useFsAccessApi:o().bool,onDragEnter:o().func,onDragLeave:o().func,onDragOver:o().func,onDrop:o().func,onDropAccepted:o().func,onDropRejected:o().func,validator:o().func};const ie=ne;var oe={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,draggedFiles:[],acceptedFiles:[],fileRejections:[]};function ae(e,t){switch(t.type){case"focus":return X(X({},e),{},{isFocused:!0});case"blur":return X(X({},e),{},{isFocused:!1});case"openDialog":return X(X({},oe),{},{isFileDialogActive:!0});case"closeDialog":return X(X({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":var n=t.isDragActive,r=t.draggedFiles;return X(X({},e),{},{draggedFiles:r,isDragActive:n});case"setFiles":return X(X({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return X({},oe);default:return e}}function ce(){}}}]);
|